Exemple #1
0
 def _get_create_network_body(self, network):
     body = {
         'network': {
             'tenant_id': self.project_id,
             'name': utils.get_bottom_network_name(network),
             'admin_state_up': True
         }
     }
     return body
Exemple #2
0
 def list_resources(t_ctx_, q_ctx, pod_, ele_, _type_):
     client = self._get_client(pod_['pod_name'])
     if _type_ == t_constants.RT_NETWORK:
         value = utils.get_bottom_network_name(ele_)
     else:
         value = ele_['id']
     return client.list_resources(_type_, t_ctx_,
                                  [{'key': 'name', 'comparator': 'eq',
                                    'value': value}])
Exemple #3
0
 def list_resources(t_ctx, q_ctx, pod_, ele_, _type_):
     client = self._get_client(pod_['pod_name'])
     if _type_ == constants.RT_NETWORK:
         value = utils.get_bottom_network_name(ele_)
     else:
         value = ele_['id']
     return client.list_resources(
         _type_, t_ctx,
         [{'key': 'name', 'comparator': 'eq',
           'value': value}])
Exemple #4
0
 def list_resources(t_ctx_, q_ctx, pod_, ele_, _type_):
     client = self._get_client(pod_['region_name'])
     if _type_ == t_constants.RT_NS_ROUTER:
         _type_ = t_constants.RT_ROUTER
         value = t_constants.ns_router_name % ele_['id']
     elif _type_ == t_constants.RT_SD_PORT:
         _type_ = t_constants.RT_PORT
         value = t_constants.shadow_port_name % ele_['id']
     elif _type_ == t_constants.RT_NETWORK:
         value = utils.get_bottom_network_name(ele_)
     else:
         value = ele_['id']
     return client.list_resources(_type_, t_ctx_,
                                  [{'key': 'name', 'comparator': 'eq',
                                    'value': value}])
Exemple #5
0
 def list_resources(t_ctx_, q_ctx, pod_, ele_, _type_):
     client = self._get_client(pod_['region_name'])
     if _type_ == t_constants.RT_NS_ROUTER:
         _type_ = t_constants.RT_ROUTER
         value = t_constants.ns_router_name % ele_['id']
     elif _type_ == t_constants.RT_SD_PORT:
         _type_ = t_constants.RT_PORT
         value = t_constants.shadow_port_name % ele_['id']
     elif _type_ == t_constants.RT_NETWORK:
         value = utils.get_bottom_network_name(ele_)
     else:
         value = ele_['id']
     return client.list_resources(_type_, t_ctx_,
                                  [{'key': 'name', 'comparator': 'eq',
                                    'value': value}])
Exemple #6
0
    def get_create_network_body(project_id, network):
        """Get request body to create bottom network

        :param project_id: project id
        :param network: top network dict
        :return: request body to create bottom network
        """
        body = {
            'network': {
                'tenant_id': project_id,
                'name': utils.get_bottom_network_name(network),
                'admin_state_up': True
            }
        }
        network_type = network.get(provider_net.NETWORK_TYPE)
        if network_type == t_constants.NT_VLAN:
            body['network'][provider_net.NETWORK_TYPE] = 'vlan'
            body['network'][provider_net.PHYSICAL_NETWORK] = network[
                provider_net.PHYSICAL_NETWORK]
            body['network'][provider_net.SEGMENTATION_ID] = network[
                provider_net.SEGMENTATION_ID]
        return body
Exemple #7
0
    def get_create_network_body(project_id, network):
        """Get request body to create bottom network

        :param project_id: project id
        :param network: top network dict
        :return: request body to create bottom network
        """
        body = {
            'network': {
                'tenant_id': project_id,
                'name': utils.get_bottom_network_name(network),
                'admin_state_up': True
            }
        }
        network_type = network.get(provider_net.NETWORK_TYPE)
        if network_type == t_constants.NT_VLAN:
            body['network'][provider_net.NETWORK_TYPE] = 'vlan'
            body['network'][provider_net.PHYSICAL_NETWORK] = network[
                provider_net.PHYSICAL_NETWORK]
            body['network'][provider_net.SEGMENTATION_ID] = network[
                provider_net.SEGMENTATION_ID]
        return body
Exemple #8
0
    def get_create_network_body(project_id, network):
        """Get request body to create bottom network

        :param project_id: project id
        :param network: top network dict
        :return: request body to create bottom network
        """
        body = {
            'network': {
                'tenant_id': project_id,
                'name': utils.get_bottom_network_name(network),
                'admin_state_up': True
            }
        }
        network_type = network.get('provider:network_type')
        if network_type == t_constants.NT_SHARED_VLAN:
            body['network']['provider:network_type'] = 'vlan'
            body['network']['provider:physical_network'] = network[
                'provider:physical_network']
            body['network']['provider:segmentation_id'] = network[
                'provider:segmentation_id']
        return body
Exemple #9
0
    def get_create_network_body(project_id, network):
        """Get request body to create bottom network

        :param project_id: project id
        :param network: top network dict
        :return: request body to create bottom network
        """
        body = {
            'network': {
                'tenant_id': project_id,
                'name': utils.get_bottom_network_name(network),
                'admin_state_up': True
            }
        }
        network_type = network.get('provider:network_type')
        if network_type == t_constants.NT_VLAN:
            body['network']['provider:network_type'] = 'vlan'
            body['network']['provider:physical_network'] = network[
                'provider:physical_network']
            body['network']['provider:segmentation_id'] = network[
                'provider:segmentation_id']
        return body