Adding v6 support to vrouter
Change-Id: I0abe5fe2debf4a6697a84b5507ea9c453d14bf34
diff --git a/xos/synchronizer/steps/test_sync_routes.py b/xos/synchronizer/steps/test_sync_routes.py
index 1e227a2..d64272f 100644
--- a/xos/synchronizer/steps/test_sync_routes.py
+++ b/xos/synchronizer/steps/test_sync_routes.py
@@ -75,11 +75,9 @@
for (k, v) in model_accessor.all_model_classes.items():
globals()[k] = v
-
self.sync_step = SyncRoutes
self.sync_step.log = Mock()
-
# mock onos-fabric
onos_fabric = Mock()
onos_fabric.name = "onos-fabric"
@@ -105,18 +103,15 @@
self.o.vrouter.owner = self.vrouter
self.o.tologdict.return_value = {}
-
-
-
def tearDown(self):
self.o = None
sys.path = self.sys_path_save
@requests_mock.Mocker()
- def test_sync_route(self, m):
+ def test_sync_route_ipv4(self, m):
- self.o.next_hop = "192.168.0.254"
self.o.prefix = "0.0.0.0/0"
+ self.o.next_hop = "192.168.0.254"
expected_conf = {
"prefix": self.o.prefix,
@@ -132,10 +127,29 @@
self.assertTrue(m.called)
@requests_mock.Mocker()
- def test_delete_route(self, m):
+ def test_sync_route_ipv6(self, m):
- self.o.next_hop = "192.168.0.254"
+ self.o.prefix = "::/0"
+ self.o.next_hop = "2001:db8:abcd:0012::0/64"
+
+ expected_conf = {
+ "prefix": self.o.prefix,
+ "nextHop": self.o.next_hop
+ }
+
+ m.post("http://onos-fabric:8181/onos/routeservice/routes",
+ status_code=204,
+ additional_matcher=functools.partial(match_json, expected_conf))
+
+ self.sync_step().sync_record(self.o)
+
+ self.assertTrue(m.called)
+
+ @requests_mock.Mocker()
+ def test_delete_route_ipv4(self, m):
+
self.o.prefix = "0.0.0.0/0"
+ self.o.next_hop = "192.168.0.254"
expected_conf = {
"prefix": self.o.prefix,
@@ -148,4 +162,23 @@
self.sync_step().delete_record(self.o)
- self.assertTrue(m.called)
\ No newline at end of file
+ self.assertTrue(m.called)
+
+ @requests_mock.Mocker()
+ def test_delete_route_ipv6(self, m):
+
+ self.o.prefix = "::/0"
+ self.o.next_hop = "2001:db8:abcd:0012::0/64"
+
+ expected_conf = {
+ "prefix": self.o.prefix,
+ "nextHop": self.o.next_hop
+ }
+
+ m.delete("http://onos-fabric:8181/onos/routeservice/routes",
+ status_code=204,
+ additional_matcher=functools.partial(match_json, expected_conf))
+
+ self.sync_step().delete_record(self.o)
+
+ self.assertTrue(m.called)