예제 #1
0
 def test_convert_subnet_dict_to_model(self):
     model_obj = utils.convert_subnet_dict_to_model(t_constants.MOCK_SUBNET)
     assert_dict = dict(id=t_constants.MOCK_SUBNET_ID,
                        name=t_constants.MOCK_SUBNET_NAME,
                        network_id=t_constants.MOCK_NETWORK_ID,
                        project_id=t_constants.MOCK_PROJECT_ID,
                        gateway_ip=t_constants.MOCK_GATEWAY_IP,
                        cidr=t_constants.MOCK_CIDR,
                        ip_version=t_constants.MOCK_IP_VERSION)
     self._compare_ignore_value_none(model_obj.to_dict(), assert_dict)
예제 #2
0
 def test_convert_subnet_dict_to_model(self):
     model_obj = utils.convert_subnet_dict_to_model(
         t_constants.MOCK_SUBNET)
     assert_dict = dict(
         id=t_constants.MOCK_SUBNET_ID,
         name=t_constants.MOCK_SUBNET_NAME,
         network_id=t_constants.MOCK_NETWORK_ID,
         project_id=t_constants.MOCK_PROJECT_ID,
         gateway_ip=t_constants.MOCK_GATEWAY_IP,
         cidr=t_constants.MOCK_CIDR,
         ip_version=t_constants.MOCK_IP_VERSION
     )
     self._compare_ignore_value_none(model_obj.to_dict(), assert_dict)
예제 #3
0
파일: base.py 프로젝트: KevoTran/octavia
 def get_subnet(self, subnet_id):
     try:
         subnet = self.neutron_client.show_subnet(subnet_id)
         return utils.convert_subnet_dict_to_model(subnet)
     except neutron_client_exceptions.NotFound:
         message = _LE('Subnet not found '
                       '(subnet id: {subnet_id}.').format(
             subnet_id=subnet_id)
         LOG.exception(message)
         raise base.SubnetNotFound(message)
     except Exception:
         message = _LE('Error retrieving subnet '
                       '(subnet id: {subnet_id}.').format(
             subnet_id=subnet_id)
         LOG.exception(message)
         raise base.NetworkException(message)
예제 #4
0
파일: base.py 프로젝트: mallow111/octavia
 def get_subnet(self, subnet_id):
     try:
         subnet = self.neutron_client.show_subnet(subnet_id)
         return utils.convert_subnet_dict_to_model(subnet)
     except neutron_client_exceptions.NotFound:
         message = _LE(
             'Subnet not found '
             '(subnet id: {subnet_id}.').format(subnet_id=subnet_id)
         LOG.exception(message)
         raise base.SubnetNotFound(message)
     except Exception:
         message = _LE(
             'Error retrieving subnet '
             '(subnet id: {subnet_id}.').format(subnet_id=subnet_id)
         LOG.exception(message)
         raise base.NetworkException(message)