Merge "Create subnets with dhcp disabled"

This commit is contained in:
Jenkins 2015-11-24 21:53:42 +00:00 committed by Gerrit Code Review
commit c169b6d4fb
4 changed files with 19 additions and 7 deletions

View File

@ -42,6 +42,9 @@ neutron_opts = [
cfg.StrOpt('neutron_uri',
default=os.environ.get('OS_URL', 'http://127.0.0.1:9696'),
help=_('Neutron URL for accessing the network service.')),
cfg.StrOpt('enable_dhcp',
default='False',
help=_('Enable or Disable dhcp for neutron subnets.')),
]
keystone_opts = [
cfg.StrOpt('auth_uri',

View File

@ -41,6 +41,7 @@ auth_token = keystone_conf.admin_token
auth_uri = keystone_conf.auth_uri.rstrip('/')
neutron_uri = cfg.CONF.neutron_client.neutron_uri
enable_dhcp = cfg.CONF.neutron_client.enable_dhcp
if username and password:
# Authenticate with password crentials
@ -146,6 +147,7 @@ def _process_subnet(neutron_network_id, endpoint_id, interface_cidr,
'network_id': neutron_network_id,
'ip_version': cidr.version,
'cidr': subnet_cidr,
'enable_dhcp': enable_dhcp,
}
if pool_id:
del new_subnet['cidr']

View File

@ -156,7 +156,8 @@ class TestKuryr(base.TestKuryrBase):
'192.168.1.0']),
'network_id': fake_neutron_network_id,
'ip_version': 4,
'subnetpool_id': fake_kuryr_subnetpool_id
'subnetpool_id': fake_kuryr_subnetpool_id,
'enable_dhcp': 'False'
}]
}
subnet_v4_id = str(uuid.uuid4())
@ -258,13 +259,15 @@ class TestKuryr(base.TestKuryrBase):
'192.168.1.0']),
'network_id': fake_neutron_network_id,
'ip_version': 4,
'subnetpool_id': fake_kuryr_subnetpool_id
'subnetpool_id': fake_kuryr_subnetpool_id,
'enable_dhcp': 'False'
}, {
'name': '-'.join([docker_endpoint_id,
'fe80::']),
'network_id': fake_neutron_network_id,
'ip_version': 6,
'subnetpool_id': fake_kuryr6_subnetpool_id
'subnetpool_id': fake_kuryr6_subnetpool_id,
'enable_dhcp': 'False'
}]
}
# The following fake response is retrieved from the Neutron doc:
@ -358,13 +361,15 @@ class TestKuryr(base.TestKuryrBase):
'192.168.1.0']),
'network_id': fake_neutron_network_id,
'ip_version': 4,
"cidr": '192.168.1.0/24'
"cidr": '192.168.1.0/24',
'enable_dhcp': 'False'
}, {
'name': '-'.join([docker_endpoint_id,
'fe80::']),
'network_id': fake_neutron_network_id,
'ip_version': 6,
"cidr": 'fe80::/64'
"cidr": 'fe80::/64',
'enable_dhcp': 'False'
}]
}
# The following fake response is retrieved from the Neutron doc:

View File

@ -39,12 +39,14 @@ class TestKuryrEndpointFailures(base.TestKuryrFailures):
'name': '-'.join([docker_endpoint_id, '192.168.1.0']),
'network_id': neutron_network_id,
'ip_version': 4,
"cidr": '192.168.1.0/24'
"cidr": '192.168.1.0/24',
'enable_dhcp': 'False'
}, {
'name': '-'.join([docker_endpoint_id, 'fe80::']),
'network_id': neutron_network_id,
'ip_version': 6,
"cidr": 'fe80::/64'
"cidr": 'fe80::/64',
'enable_dhcp': 'False'
}]
}
fake_subnets = self._get_fake_subnets(