From: tierno Date: Fri, 2 Dec 2016 13:40:59 +0000 (+0100) Subject: Adapt test/test_openflow.sh for ONOS because it does not allow fixing flow id X-Git-Tag: v2.0.0~69 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=d03ce285ce836b1b606ca389b5c60c57f40984b7;p=osm%2Fopenvim.git Adapt test/test_openflow.sh for ONOS because it does not allow fixing flow id Signed-off-by: tierno --- diff --git a/openflow b/openflow index 7ea59c4..80cf624 100755 --- a/openflow +++ b/openflow @@ -205,6 +205,8 @@ def of_add(args): if r<0: print c return -1 + if args.print_id: + print rule["name"] return 0 def of_delete(args): @@ -280,6 +282,7 @@ if __name__=="__main__": add_parser.add_argument("--setvlan", action="append", dest="act", type=int, help="alternative to --actions. Use before --out to set vlan") add_parser.add_argument("--out", action="append", dest="act", type=str, help="alternative to --actions. out= can be used several times") add_parser.add_argument('--debug', '-d', action='store_true', help="show debug information") + add_parser.add_argument('--print-id', action='store_true', help="print the flow id after added") add_parser.set_defaults(func=of_add) delete_parser = subparsers.add_parser('delete', help="delete an openflow rule") diff --git a/test/test_openflow.sh b/test/test_openflow.sh index 3f76771..2c9b504 100755 --- a/test/test_openflow.sh +++ b/test/test_openflow.sh @@ -146,7 +146,7 @@ TODELETE="restore" printf "%-50s" "new rule vlan,mac -> no vlan: " rule_name=fromVlanMac_to_NoVlan1 -openflow add $rule_name --priority 1000 --matchmac "aa:bb:cc:dd:ee:ff" --matchvlan 500 --inport $port0 --stripvlan --out $port1 $debug +rule_name=`openflow add $rule_name --priority 1000 --matchmac "aa:bb:cc:dd:ee:ff" --matchvlan 500 --inport $port0 --stripvlan --out $port1 $debug --print-id` [[ $? != 0 ]] && echo "FAIL cannot insert new rule" && $_exit 1 expected="$OF_CONTROLLER_DPID 1000 $rule_name $port0 aa:bb:cc:dd:ee:ff 500 vlan=None,out=$port1" result=`openflow list | grep $rule_name` @@ -158,7 +158,7 @@ TODELETE="$rule_name $TODELETE" printf "%-50s" "new rule mac -> vlan: " rule_name=fromMac_to_Vlan2 -openflow add $rule_name --priority 1001 --matchmac "ff:ff:ff:ff:ff:ff" --inport $port1 --setvlan 501 --out $port2 --out $port3 $debug +rule_name=`openflow add $rule_name --priority 1001 --matchmac "ff:ff:ff:ff:ff:ff" --inport $port1 --setvlan 501 --out $port2 --out $port3 $debug --print-id` [[ $? != 0 ]] && echo "FAIL cannot insert new rule" && $_exit 1 expected="$OF_CONTROLLER_DPID 1001 $rule_name $port1 ff:ff:ff:ff:ff:ff any vlan=501,out=$port2,out=$port3" result=`openflow list | grep $rule_name` @@ -170,7 +170,7 @@ TODELETE="$rule_name $TODELETE" printf "%-50s" "new rule None -> None: " rule_name=fromNone_to_None -openflow add $rule_name --priority 1002 --inport $port2 --out $port0 $debug +rule_name=`openflow add $rule_name --priority 1002 --inport $port2 --out $port0 $debug --print-id` [[ $? != 0 ]] && echo "FAIL cannot insert new rule" && $_exit 1 expected="$OF_CONTROLLER_DPID 1002 $rule_name $port2 any any out=$port0" result=`openflow list | grep $rule_name` @@ -182,7 +182,7 @@ TODELETE="$rule_name $TODELETE" printf "%-50s" "new rule vlan -> vlan: " rule_name=fromVlan_to_Vlan1 -openflow add $rule_name --priority 1003 --matchvlan 504 --inport $port3 --setvlan 505 --out $port0 $debug +rule_name=`openflow add $rule_name --priority 1003 --matchvlan 504 --inport $port3 --setvlan 505 --out $port0 $debug --print-id` [[ $? != 0 ]] && echo "FAIL cannot insert new rule" && $_exit 1 expected="$OF_CONTROLLER_DPID 1003 $rule_name $port3 any 504 vlan=505,out=$port0" result=`openflow list | grep $rule_name` @@ -198,7 +198,7 @@ then printf "%-50s" "new rule Vlan -> Vlan_Vlan: " rule_name=fromVlan_to_Vlan1Vlan1 - openflow add $rule_name --priority 1005 --inport $port3 --matchvlan 505 --setvlan 510 --out $port0 --setvlan 511 --out $port1 --stripvlan --out=$port2 $debug + rule_name=`openflow add $rule_name --priority 1005 --inport $port3 --matchvlan 505 --setvlan 510 --out $port0 --setvlan 511 --out $port1 --stripvlan --out=$port2 $debug --print-id` [[ $? != 0 ]] && echo "FAIL cannot insert new rule" && $_exit 1 expected="$OF_CONTROLLER_DPID 1005 $rule_name $port3 any 505 vlan=510,out=$port0,vlan=511,out=$port1,vlan=None,out=$port2" result=`openflow list | grep $rule_name`