[ONOS-7430] Add option to use portstate for link-down/up in FUNCintent test
Change-Id: I31407f26159dd59e009f169d84b74665bc5363d8
diff --git a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
index 0fcd334..afe4c4a 100644
--- a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
@@ -2112,12 +2112,19 @@
def link( main, sw1, sw2, option ):
-
- # link down
- main.log.info( itemName + ": Bring link " + option + " between " +
- sw1 + " and " + sw2 )
- linkResult = main.Network.link( end1=sw1, end2=sw2, option=option )
- return linkResult
+ if main.usePortstate:
+ # port down
+ dpid = main.params[ 'MININET' ][ 'dpids' ][ sw1 ]
+ port = main.params[ 'MININET' ][ 'ports' ][ sw1 ][ sw2 ]
+ main.log.info( itemName + ": Bring port " + sw1 + "/" + port + " " + option )
+ state = "disable" if option == "down" else "enable"
+ result = main.Cluster.active( 0 ).CLI.portstate( dpid=dpid, port=port, state=state )
+ else:
+ # link down
+ main.log.info( itemName + ": Bring link " + option + " between " +
+ sw1 + " and " + sw2 )
+ result = main.Network.link( end1=sw1, end2=sw2, option=option )
+ return result
def scapyCheckConnection( main,