diff options
Diffstat (limited to 'snaps/config/network.py')
-rw-r--r-- | snaps/config/network.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/snaps/config/network.py b/snaps/config/network.py index eca8734..b142480 100644 --- a/snaps/config/network.py +++ b/snaps/config/network.py @@ -46,6 +46,7 @@ class NetworkConfig(object): :param segmentation_id: the id of the segmentation (this is required when network_type is 'vlan') :param subnets or subnet_settings: List of SubnetConfig objects. + :param mtu: MTU setting (optional) :return: """ @@ -88,6 +89,8 @@ class NetworkConfig(object): if not self.name or len(self.name) < 1: raise NetworkConfigError('Name required for networks') + self.mtu = kwargs.get('mtu') + def get_project_id(self, os_creds): """ Returns the project ID for a given project_name or None @@ -144,6 +147,8 @@ class NetworkConfig(object): out['provider:segmentation_id'] = self.segmentation_id if self.external: out['router:external'] = self.external + if self.mtu: + out['mtu'] = self.mtu return {'network': out} @@ -444,7 +449,6 @@ class PortConfig(object): TODO - expand automated testing to exercise all parameters :param neutron: the Neutron client - :param keystone: the Keystone client :param os_creds: the OpenStack credentials :return: the dictionary object """ @@ -457,8 +461,11 @@ class PortConfig(object): project_name = project_name try: network = neutron_utils.get_network( - neutron, keystone, network_name=self.network_name, - project_name=project_name) + neutron, keystone, network_name=self.network_name) + if network and not (network.shared or network.external): + network = neutron_utils.get_network( + neutron, keystone, network_name=self.network_name, + project_name=project_name) finally: if session: keystone_utils.close_session(session) |