diff --git a/config.yaml b/config.yaml index 540f1cbd..8c0b6cb7 100755 --- a/config.yaml +++ b/config.yaml @@ -127,6 +127,11 @@ options: specifying physical_network names usable for VLAN provider and tenant networks, as well as ranges of VLAN tags on each available for allocation to tenant networks. + vni-ranges: + type: string + default: "1001:2000" + description: | + Space-delimited list of : for VXLAN provider. # Quota configuration settings quota-security-group: default: 10 diff --git a/hooks/neutron_api_context.py b/hooks/neutron_api_context.py index 0b384680..d085bb20 100644 --- a/hooks/neutron_api_context.py +++ b/hooks/neutron_api_context.py @@ -233,6 +233,10 @@ class NeutronCCContext(context.NeutronContext): if vlan_ranges: ctxt['vlan_ranges'] = ','.join(vlan_ranges.split()) + vni_ranges = config('vni-ranges') + if vni_ranges: + ctxt['vni_ranges'] = ','.join(vni_ranges.split()) + ctxt['enable_ml2_port_security'] = config('enable-ml2-port-security') return ctxt diff --git a/templates/icehouse/ml2_conf.ini b/templates/icehouse/ml2_conf.ini index f6bbaf64..1a6c3178 100644 --- a/templates/icehouse/ml2_conf.ini +++ b/templates/icehouse/ml2_conf.ini @@ -16,7 +16,7 @@ mechanism_drivers = openvswitch,hyperv,l2population tunnel_id_ranges = 1:1000 [ml2_type_vxlan] -vni_ranges = 1001:2000 +vni_ranges = {{ vni_ranges }} [ml2_type_vlan] network_vlan_ranges = {{ vlan_ranges }} diff --git a/templates/kilo/ml2_conf.ini b/templates/kilo/ml2_conf.ini index 19dce284..bba9dde2 100644 --- a/templates/kilo/ml2_conf.ini +++ b/templates/kilo/ml2_conf.ini @@ -20,7 +20,7 @@ mechanism_drivers = openvswitch,l2population tunnel_id_ranges = 1:1000 [ml2_type_vxlan] -vni_ranges = 1001:2000 +vni_ranges = {{ vni_ranges }} [ml2_type_vlan] network_vlan_ranges = {{ vlan_ranges }} diff --git a/unit_tests/test_neutron_api_context.py b/unit_tests/test_neutron_api_context.py index 4667ca51..003396d2 100644 --- a/unit_tests/test_neutron_api_context.py +++ b/unit_tests/test_neutron_api_context.py @@ -319,6 +319,7 @@ class NeutronCCContextTest(CharmTestCase): 'quota_subnet': 10, 'quota_vip': 10, 'vlan_ranges': 'physnet1:1000:2000', + 'vni_ranges': '1001:2000', 'enable_ml2_port_security': True } napi_ctxt = context.NeutronCCContext() @@ -332,6 +333,7 @@ class NeutronCCContextTest(CharmTestCase): plugin.return_value = None self.test_config.set('flat-network-providers', 'physnet2 physnet3') self.test_config.set('overlay-network-type', 'vxlan') + self.test_config.set('vni-ranges', '1001:2000 3001:4000') ctxt_data = { 'debug': True, 'enable_dvr': False, @@ -354,6 +356,7 @@ class NeutronCCContextTest(CharmTestCase): 'quota_subnet': 10, 'quota_vip': 10, 'vlan_ranges': 'physnet1:1000:2000', + 'vni_ranges': '1001:2000,3001:4000', 'network_providers': 'physnet2,physnet3', 'enable_ml2_port_security': True } @@ -395,6 +398,7 @@ class NeutronCCContextTest(CharmTestCase): 'quota_subnet': 10, 'quota_vip': 10, 'vlan_ranges': 'physnet1:1000:2000', + 'vni_ranges': '1001:2000', 'enable_ml2_port_security': True } napi_ctxt = context.NeutronCCContext()