Ejemplo n.º 1
0
 def test_create_route_gateway_conflict_raises(self):
     cidr = "192.168.0.0/24"
     ip_policy = dict(exclude=["192.168.0.0/32", "192.168.0.255/32"])
     ip_policy = {"ip_policy": ip_policy}
     network = dict(name="public", tenant_id="fake", network_plugin="BASE")
     network = {"network": network}
     subnet = dict(ip_version=4, next_auto_assign_ip=2,
                   cidr=cidr, ip_policy=None,
                   tenant_id="fake")
     create_route = dict(cidr="192.168.0.0/24", gateway="192.168.0.1")
     subnet = {"subnet": subnet}
     with self._stubs(network, subnet, ip_policy) as (net, sub, ipp):
         self.assertIsNotNone(net)
         self.assertIsNotNone(sub)
         self.assertIsNotNone(ipp)
         create_route["subnet_id"] = sub["id"]
         with self.assertRaises(n_exc.BadRequest):
             routes_api.create_route(self.context,
                                     dict(route=create_route))
Ejemplo n.º 2
0
 def test_create_route_gateway_conflict_raises(self):
     cidr = "192.168.0.0/24"
     ip_policy = dict(exclude=["192.168.0.0/32", "192.168.0.255/32"])
     ip_policy = {"ip_policy": ip_policy}
     network = dict(name="public", tenant_id="fake", network_plugin="BASE")
     network = {"network": network}
     subnet = dict(ip_version=4,
                   next_auto_assign_ip=2,
                   cidr=cidr,
                   ip_policy=None,
                   tenant_id="fake")
     create_route = dict(cidr="192.168.0.0/24", gateway="192.168.0.1")
     subnet = {"subnet": subnet}
     with self._stubs(network, subnet, ip_policy) as (net, sub, ipp):
         self.assertIsNotNone(net)
         self.assertIsNotNone(sub)
         self.assertIsNotNone(ipp)
         create_route["subnet_id"] = sub["id"]
         with self.assertRaises(n_exc.BadRequest):
             routes_api.create_route(self.context, dict(route=create_route))
Ejemplo n.º 3
0
 def test_create_no_other_routes(self):
     cidr = "192.168.0.0/24"
     ip_policy = dict(exclude=["192.168.0.0/32", "192.168.0.1/32",
                               "192.168.0.255/32"])
     ip_policy = {"ip_policy": ip_policy}
     network = dict(name="public", tenant_id="fake", network_plugin="BASE")
     network = {"network": network}
     subnet = dict(ip_version=4, cidr=cidr, ip_policy=None,
                   tenant_id="fake")
     create_route = dict(cidr="192.168.0.0/24", gateway="192.168.0.1")
     subnet = {"subnet": subnet}
     with self._stubs(network, subnet, ip_policy) as (net, sub, ipp):
         self.assertIsNotNone(net)
         self.assertIsNotNone(sub)
         self.assertIsNotNone(ipp)
         create_route["subnet_id"] = sub["id"]
         route = routes_api.create_route(self.context,
                                         dict(route=create_route))
         for key in create_route.keys():
             self.assertEqual(create_route[key], route[key])
Ejemplo n.º 4
0
 def test_create_no_other_routes(self):
     cidr = "192.168.0.0/24"
     ip_policy = dict(
         exclude=["192.168.0.0/32", "192.168.0.1/32", "192.168.0.255/32"])
     ip_policy = {"ip_policy": ip_policy}
     network = dict(name="public", tenant_id="fake", network_plugin="BASE")
     network = {"network": network}
     subnet = dict(ip_version=4,
                   cidr=cidr,
                   ip_policy=None,
                   tenant_id="fake")
     create_route = dict(cidr="192.168.0.0/24", gateway="192.168.0.1")
     subnet = {"subnet": subnet}
     with self._stubs(network, subnet, ip_policy) as (net, sub, ipp):
         self.assertIsNotNone(net)
         self.assertIsNotNone(sub)
         self.assertIsNotNone(ipp)
         create_route["subnet_id"] = sub["id"]
         route = routes_api.create_route(self.context,
                                         dict(route=create_route))
         for key in create_route.keys():
             self.assertEqual(create_route[key], route[key])
Ejemplo n.º 5
0
 def create_route(self, context, route):
     self._fix_missing_tenant_id(context, route["route"])
     return routes.create_route(context, route)
Ejemplo n.º 6
0
 def create_route(self, context, route):
     return routes.create_route(context, route)
Ejemplo n.º 7
0
 def create_route(self, context, route):
     self._fix_missing_tenant_id(context, route["route"])
     return routes.create_route(context, route)
Ejemplo n.º 8
0
 def create_route(self, context, route):
     return routes.create_route(context, route)