X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=snaps%2Fconfig%2Fnetwork.py;h=ffafbb6652882468fae997c139285ee28e137eb3;hb=90ca47a7027f37d7528ec0b022306ba6472fd412;hp=85a9faef8967564d4c9a9b2af81676f09890ecfb;hpb=021432b38b6e9de94e81590da2f1c9e7ea8b63ea;p=snaps.git diff --git a/snaps/config/network.py b/snaps/config/network.py index 85a9fae..ffafbb6 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 """ @@ -458,6 +462,10 @@ class PortConfig(object): try: network = neutron_utils.get_network( neutron, keystone, network_name=self.network_name) + if network and (not network.shared or not 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)