Ask is moving to Stack Overflow and Serverfault.com! Please use the "opendaylight" tag on either of these sites. This site is now in Read-Only mode

Revision history [back]

click to hide/show revision 1
initial version

Hi Karthik330

I have just used meter with RESTCONF flows, not through native jave code with MD-SAL. However, to make metering for specific flow, you may do two things: 1- Define the meter instruction. 2- Include the meter instruction defined in (1) as one of the instructions inside the flow that requires this meter to be achieved.

Example for point (1)

curl --user "admin":"admin" -H "Accept: application/xml" -H "Content-type: application/xml" -X PUT http://localhost:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:3/meter/1 -d '<meter xmlns="urn:opendaylight:flow:inventory"> <meter-id>1</meter-id> <container-name>mymeter</container-name> <meter-name>mymeter</meter-name> <flags>meter-kbps</flags> <meter-band-headers> <meter-band-header> <band-id>0</band-id> <band-rate>600</band-rate> <meter-band-types> <flags>ofpmbt-drop</flags> </meter-band-types> <band-burst-size>0</band-burst-size> <drop-rate>600</drop-rate> <drop-burst-size>0</drop-burst-size> </meter-band-header> </meter-band-headers> </meter>'

Example for point (2)

curl --user "admin":"admin" -H "Accept: application/xml" -H "Content-type: application/xml" -X PUT http://localhost:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:3/table/0/flow/21 -d '<flow xmlns="urn:opendaylight:flow:inventory"><hard-timeout>0</hard-timeout><idle-timeout>0</idle-timeout><priority>2</priority><flow-name>h2_ping</flow-name><match><ethernet-match><ethernet-type><type>2048</type></ethernet-type></ethernet-match><ipv4-destination>10.0.0.1/32</ipv4-destination><ip-match><ip-dscp>10</ip-dscp></ip-match></match><id>21</id><table_id>0</table_id><instructions><instruction><order>1</order><apply-actions><action><output-action><output-node-connector>2</output-node-connector></output-action><order>0</order></action></apply-actions></instruction><instruction><order>0</order><meter><meter-id>1</meter-id></meter></instruction></instructions></flow>'

Regards, Walid

Hi Karthik330

I have just used meter with RESTCONF flows, not through native jave code with MD-SAL. However, to make metering for specific flow, you may do two things: 1- Define the meter instruction. 2- Include the meter instruction defined in (1) as one of the instructions inside the flow that requires this meter to be achieved.

Example for point (1)

curl --user "admin":"admin" -H "Accept: application/xml" -H "Content-type: application/xml" -X PUT http://localhost:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:3/meter/1 -d -d

'<meter xmlns="urn:opendaylight:flow:inventory"> <meter-id>1</meter-id> <container-name>mymeter</container-name> <meter-name>mymeter</meter-name> <flags>meter-kbps</flags> <meter-band-headers> <meter-band-header> <band-id>0</band-id> <band-rate>600</band-rate> <meter-band-types> <flags>ofpmbt-drop</flags> </meter-band-types> <band-burst-size>0</band-burst-size> <drop-rate>600</drop-rate> <drop-burst-size>0</drop-burst-size> </meter-band-header> </meter-band-headers> </meter>'

Example for point (2)

curl --user "admin":"admin" -H "Accept: application/xml" -H "Content-type: application/xml" -X PUT http://localhost:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:3/table/0/flow/21 -d '<flow xmlns="urn:opendaylight:flow:inventory"><hard-timeout>0</hard-timeout><idle-timeout>0</idle-timeout><priority>2</priority><flow-name>h2_ping</flow-name><match><ethernet-match><ethernet-type><type>2048</type></ethernet-type></ethernet-match><ipv4-destination>10.0.0.1/32</ipv4-destination><ip-match><ip-dscp>10</ip-dscp></ip-match></match><id>21</id><table_id>0</table_id><instructions><instruction><order>1</order><apply-actions><action><output-action><output-node-connector>2</output-node-connector></output-action><order>0</order></action></apply-actions></instruction><instruction><order>0</order><meter><meter-id>1</meter-id></meter></instruction></instructions></flow>'

Regards, Walid

Hi Karthik330

I have just used meter with RESTCONF flows, not through native jave code with MD-SAL. However, to make metering for specific flow, you may do two things: 1- Define the meter instruction. 2- Include the meter instruction defined in (1) as one of the instructions inside the flow that requires this meter to be achieved.

Example for point (1)

curl --user "admin":"admin" -H "Accept: application/xml" -H "Content-type: application/xml" -X PUT http://localhost:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:3/meter/1 -d

'<meter xmlns="urn:opendaylight:flow:inventory"> <meter-id>1</meter-id> <container-name>mymeter</container-name> <meter-name>mymeter</meter-name> <flags>meter-kbps</flags> <meter-band-headers> <meter-band-header> <band-id>0</band-id> <band-rate>600</band-rate> <meter-band-types> <flags>ofpmbt-drop</flags> </meter-band-types> <band-burst-size>0</band-burst-size> <drop-rate>600</drop-rate> <drop-burst-size>0</drop-burst-size> </meter-band-header> </meter-band-headers> </meter>'

Example for point (2)

curl --user "admin":"admin" -H "Accept: application/xml" -H "Content-type: application/xml" -X PUT http://localhost:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:3/table/0/flow/21 -d -d

'<flow xmlns="urn:opendaylight:flow:inventory"><hard-timeout>0</hard-timeout><idle-timeout>0</idle-timeout><priority>2</priority><flow-name>h2_ping</flow-name><match><ethernet-match><ethernet-type><type>2048</type></ethernet-type></ethernet-match><ipv4-destination>10.0.0.1/32</ipv4-destination><ip-match><ip-dscp>10</ip-dscp></ip-match></match><id>21</id><table_id>0</table_id><instructions><instruction><order>1</order><apply-actions><action><output-action><output-node-connector>2</output-node-connector></output-action><order>0</order></action></apply-actions></instruction><instruction><order>0</order><meter><meter-id>1</meter-id></meter></instruction></instructions></flow>'

Regards, Walid