diff --git a/kuryr/common/constants.py b/kuryr/common/constants.py index 30f531df..37fe6f5b 100644 --- a/kuryr/common/constants.py +++ b/kuryr/common/constants.py @@ -18,6 +18,13 @@ SCHEMA = { "SUCCESS": {} } +# Routes are either given a RouteType of 0 and a value for NextHop; +# or, a RouteType of 1 and no value for NextHop, meaning a connected route. +ROUTE_TYPE = { + "NEXTHOP": 0, + "CONNECTED": 1 +} + DEVICE_OWNER = 'kuryr:container' NIC_NAME_LEN = 14 VETH_PREFIX = 'tap' diff --git a/kuryr/controllers.py b/kuryr/controllers.py index 578c094b..45072cea 100644 --- a/kuryr/controllers.py +++ b/kuryr/controllers.py @@ -851,10 +851,10 @@ def network_driver_join(): 'Destination': host_route['destination'] } if host_route.get('nexthop', None): - static_route['RouteType'] = const.TYPES['NEXTHOP'] + static_route['RouteType'] = const.ROUTE_TYPE['NEXTHOP'] static_route['NextHop'] = host_route['nexthop'] else: - static_route['RouteType'] = const.TYPES['CONNECTED'] + static_route['RouteType'] = const.ROUTE_TYPE['CONNECTED'] join_response['StaticRoutes'].append(static_route) return flask.jsonify(join_response)