Seamless shit for dhcpl2relay.
It never looked to have been seamless before.
Anyway, now after setup.
run -m <> -t dhcpl2relay:dhcpl2relay_exchange.test_dhcpl2relay_initialize
to bootstrap the relay.
Then one can try firing the test from the olt node or same node.
Supports 1 subscriber dhcp.
You are supposed to run the tls test actually.
But there is support in dhcpl2relay app itself to provision the olt subscribers (vlans)
Change-Id: Ibcdf3bf4f0962d174f245ca914b97c644001d729
diff --git a/src/test/utils/CordTestServer.py b/src/test/utils/CordTestServer.py
index e495afb..6e1ae31 100644
--- a/src/test/utils/CordTestServer.py
+++ b/src/test/utils/CordTestServer.py
@@ -31,6 +31,8 @@
#
from CordContainer import Container, Onos, OnosStopWrapper, OnosCord, OnosCordStopWrapper, Quagga, QuaggaStopWrapper, Radius, reinitContainerClients
from OltConfig import OltConfig
+from OnosCtrl import OnosCtrl
+from CordTestUtils import get_controller
from EapolAAA import get_radius_macs, get_radius_networks
from nose.tools import nottest
from SimpleXMLRPCServer import SimpleXMLRPCServer
@@ -53,6 +55,17 @@
onos_cord = None
+ def __ovs_flow_add(self, in_port = 1, dl_vlan = 0):
+ if dl_vlan:
+ cmd = 'ovs-ofctl -O OpenFlow13 add-flow br-int in_port=%d,dl_vlan=%d,actions=CONTROLLER:65535' %(in_port, dl_vlan)
+ else:
+ cmd = 'ovs-ofctl -O OpenFlow13 add-flow br-int in_port=%d,actions=CONTROLLER:65535' %(in_port)
+ os.system(cmd)
+ return 'DONE'
+
+ def ovs_flow_add(self, kwargs):
+ return self.__ovs_flow_add(**kwargs)
+
def __restart_onos(self, node = None, config = None, timeout = 10):
if self.onos_cord:
onos_config = '{}/network-cfg.json'.format(self.onos_cord.onos_config_dir)
@@ -235,9 +248,10 @@
port = int(os.getenv('CORD_TEST_PORT', CORD_TEST_PORT))
return host, port
-def rpc_server_instance():
+def rpc_server_instance(host = None, port = None):
'''Stateless'''
- host, port = get_cord_test_loc()
+ if host is None or port is None:
+ host, port = get_cord_test_loc()
rpc_server = 'http://{}:{}'.format(host, port)
return xmlrpclib.Server(rpc_server, allow_none = True)
@@ -357,3 +371,26 @@
except: pass
return True
+
+@nottest
+def __cord_test_ovs_flow_add(**kwargs):
+ controller = get_controller()
+ OnosCtrl.config_extraneous_flows(controller = controller)
+ try:
+ return rpc_server_instance(host = controller, port = CORD_TEST_PORT).ovs_flow_add(kwargs)
+ except:
+ pass
+
+ try:
+ return rpc_server_instance().ovs_flow_add(kwargs)
+ except:
+ pass
+
+ return 'FAIL'
+
+@nottest
+def cord_test_ovs_flow_add(in_port, dl_vlan = 0):
+ data = __cord_test_ovs_flow_add(in_port = in_port, dl_vlan = dl_vlan)
+ if data == 'DONE':
+ return True
+ return False
diff --git a/src/test/utils/OnosCtrl.py b/src/test/utils/OnosCtrl.py
index 457c05b..f460450 100644
--- a/src/test/utils/OnosCtrl.py
+++ b/src/test/utils/OnosCtrl.py
@@ -461,3 +461,13 @@
cfg = dict(enableDhcpIgmpOnProvisioning = enableDhcpIgmpOnProvisioning, defaultVlan = defaultVlan)
resp = requests.post(property_url, auth = cls.auth, data = json.dumps(cfg))
return resp.ok, resp.status_code
+
+ @classmethod
+ def config_extraneous_flows(cls, controller = None, enable = True):
+ if controller is None:
+ controller = cls.controller
+ flow_property_url = 'configuration/org.onosproject.net.flow.impl.FlowRuleManager'
+ property_url = 'http://{}:8181/onos/v1/{}'.format(controller, flow_property_url)
+ cfg = dict(allowExtraneousRules = enable)
+ resp = requests.post(property_url, auth = cls.auth, data = json.dumps(cfg))
+ return resp.ok, resp.status_code