It lets Neutron handle str or unicode instead of returning None.
It reverts the first proposal [1] which raises side effects [2].
[1] https://gerrit.opnfv.org/gerrit/#/c/56171/
[2] https://build.opnfv.org/ci/view/functest/job/functest-compass-baremetal-daily-master/126/console
Change-Id: I1b45c7d6118321dd67343f31253f154abae73655
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
scp
cryptography>=2.1 # BSD/Apache-2.0
concurrencytest
scp
cryptography>=2.1 # BSD/Apache-2.0
concurrencytest
# limitations under the License.
import logging
# limitations under the License.
import logging
from neutronclient.common.exceptions import NotFound, Unauthorized
from snaps.config.router import RouterConfig
from neutronclient.common.exceptions import NotFound, Unauthorized
from snaps.config.router import RouterConfig
:param sub_config:
:return:
"""
:param sub_config:
:return:
"""
- if isinstance(sub_config, six.text_type):
- return neutron_utils.get_subnet_by_name(
- self._neutron, self._keystone,
- subnet_name=sub_config)
if isinstance(sub_config, dict):
sub_dict = sub_config['subnet']
network = neutron_utils.get_network(
if isinstance(sub_config, dict):
sub_dict = sub_config['subnet']
network = neutron_utils.get_network(
return neutron_utils.get_subnet(
self._neutron, network,
subnet_name=sub_dict['subnet_name'])
return neutron_utils.get_subnet(
self._neutron, network,
subnet_name=sub_dict['subnet_name'])
+ else:
+ return neutron_utils.get_subnet_by_name(
+ self._neutron, self._keystone,
+ subnet_name=sub_config)