Merge "Handle subnet without gateway"
This commit is contained in:
commit
3c1a92403f
|
@ -1396,7 +1396,8 @@ def network_driver_join():
|
|||
"SrcName": iface_name,
|
||||
"DstPrefix": config.CONF.binding.veth_dst_prefix
|
||||
},
|
||||
"StaticRoutes": []
|
||||
"StaticRoutes": [],
|
||||
"DisableGatewayService": True,
|
||||
}
|
||||
|
||||
for subnet in all_subnets:
|
||||
|
@ -1725,7 +1726,12 @@ def ipam_request_address():
|
|||
if is_gateway:
|
||||
# check if request gateway ip same with existed gateway ip
|
||||
existed_gateway_ip = subnet.get('gateway_ip', '')
|
||||
if req_address == existed_gateway_ip:
|
||||
if not req_address:
|
||||
if subnet['ip_version'] == 4:
|
||||
allocated_address = "0.0.0.0/0"
|
||||
else:
|
||||
allocated_address = "::/0"
|
||||
elif req_address == existed_gateway_ip:
|
||||
allocated_address = '{}/{}'.format(req_address,
|
||||
subnet_cidr.prefixlen)
|
||||
else:
|
||||
|
|
|
@ -2179,7 +2179,8 @@ class TestKuryr(base.TestKuryrBase):
|
|||
'DstPrefix': config.CONF.binding.veth_dst_prefix,
|
||||
'SrcName': fake_iface_name,
|
||||
},
|
||||
'StaticRoutes': []
|
||||
'StaticRoutes': [],
|
||||
'DisableGatewayService': True
|
||||
}
|
||||
|
||||
self.assertEqual(200, response.status_code)
|
||||
|
@ -2296,7 +2297,8 @@ class TestKuryr(base.TestKuryrBase):
|
|||
'DstPrefix': config.CONF.binding.veth_dst_prefix,
|
||||
'SrcName': fake_iface_name,
|
||||
},
|
||||
'StaticRoutes': []
|
||||
'StaticRoutes': [],
|
||||
'DisableGatewayService': True
|
||||
}
|
||||
|
||||
self.assertEqual(200, response.status_code)
|
||||
|
@ -2405,7 +2407,8 @@ class TestKuryr(base.TestKuryrBase):
|
|||
fake_v4_subnet['subnet']['host_routes'][0]['nexthop'],
|
||||
'Destination':
|
||||
fake_v4_subnet['subnet']['host_routes'][0]['destination'],
|
||||
'RouteType': constants.ROUTE_TYPE['NEXTHOP']}]
|
||||
'RouteType': constants.ROUTE_TYPE['NEXTHOP']}],
|
||||
'DisableGatewayService': True
|
||||
}
|
||||
|
||||
self.assertEqual(200, response.status_code)
|
||||
|
|
Loading…
Reference in New Issue