Exemple #1
0
    def get_resource_data(self):
        """ get_resource_data retuns the list of all characteristics
        representing the subnet which can be directly serialized into
        the ARM template format.
        """
        heat_net_resource = base.get_ref_heat_resource(self._heat_resource,
                                                       "network_id")
        net_name = heat_net_resource.name

        return [{
            "apiVersion": constants.ARM_API_VERSION,
            "type": "Microsoft.Network/virtualNetworks",
            "name": "[variables('virtualNetworkName_%s')]" % net_name,
            "location": "[variables('location')]",
            "properties": {
                "addressSpace": {
                    "addressPrefixes": [
                        # TODO: support multiple subnets
                        "[variables('subNetAddressPrefix_%s')]" % self._name
                    ]
                },
                "subnets": [{
                    # TODO: support multiple subnets
                    # Main issue here is that ARM networkInterfaces contain a
                    # reference to a subnet, while a Neutron port contains a
                    # reference to a network
                    "name":
                    "[variables('virtualNetworkSubnetName_%s')]" % net_name,
                    "properties": {
                        "addressPrefix":
                        "[variables('subNetAddressPrefix_%s')]" % self._name
                    }
                }]
            }
        }]
Exemple #2
0
 def _get_floating_ip_resource_name(self):
     """ _get_floating_ip_resource_name is a helper function which
     returns the name of the floating IP resource associated to
     this NIC-like resource.
     """
     for heat_resource in self._heat_resource.stack.iter_resources():
         if heat_resource.type() == "OS::Neutron::FloatingIP":
             port_resource = get_ref_heat_resource(heat_resource, 'port_id')
             if port_resource is self._heat_resource:
                 return heat_resource.name
Exemple #3
0
 def _get_floating_ip_resource_name(self):
     """ _get_floating_ip_resource_name is a helper function which
     returns the name of the floating IP resource associated to
     this NIC-like resource.
     """
     for heat_resource in self._heat_resource.stack.iter_resources():
         if heat_resource.type() == "OS::Neutron::FloatingIP":
             port_resource = get_ref_heat_resource(
                 heat_resource, 'port_id')
             if port_resource is self._heat_resource:
                 return heat_resource.name
Exemple #4
0
 def _get_ref_network(self):
     """ _get_ref_network is a helper function which returns the name
     of the network which references this NIC-like resource.
     """
     if "NetworkInterfaceId" in self._heat_resource.properties.data:
         return get_ref_heat_resource(self._heat_resource,
                                      "NetworkInterfaceId")
     else:
         # the resulting Azure network interface will be attached to the
         # default VN whose creation must be signaled here:
         self._context.set_virtual_network_required()
Exemple #5
0
 def _get_ref_network(self):
     """ _get_ref_network is a helper function which returns the name
     of the network which references this NIC-like resource.
     """
     if "NetworkInterfaceId" in self._heat_resource.properties.data:
         return get_ref_heat_resource(self._heat_resource,
                                      "NetworkInterfaceId")
     else:
         # the resulting Azure network interface will be attached to the
         # default VN whose creation must be signaled here:
         self._context.set_virtual_network_required()
Exemple #6
0
    def get_resource_data(self):
        """ get_resource_data retuns the list of all characteristics
        representing the subnet which can be directly serialized into
        the ARM template format.
        """
        heat_net_resource = base.get_ref_heat_resource(
            self._heat_resource, "network_id")
        net_name = heat_net_resource.name

        return [{
            "apiVersion": constants.ARM_API_2015_05_01_PREVIEW,
            "type": "Microsoft.Network/virtualNetworks",
            "name":
            "[variables('virtualNetworkName_%s')]" % net_name,
            "location": "[variables('location')]",
            "properties": {
                "addressSpace": {
                    "addressPrefixes": [
                        # TODO: support multiple subnets
                        "[variables('subNetAddressPrefix_%s')]" % self._name
                    ]
                },
                "subnets": [{
                    # TODO: support multiple subnets
                    # Main issue here is that ARM networkInterfaces contain a
                    # reference to a subnet, while a Neutron port contains a
                    # reference to a network
                    "name":
                    "[variables('virtualNetworkSubnetName_%s')]" % net_name,
                    "properties": {
                        "addressPrefix":
                        "[variables('subNetAddressPrefix_%s')]" % self._name
                    }
                }]
            }
        }]
Exemple #7
0
 def _get_ref_network(self):
     """ _get_ref_network is a helper function which returns the name
     of the network which references this NIC-like resource.
     """
     return get_ref_heat_resource(self._heat_resource, "network_id")
Exemple #8
0
 def _get_ref_network(self):
     """ _get_ref_network is a helper function which returns the name
     of the network which references this NIC-like resource.
     """
     if "network_id" in self._heat_resource.properties.data:
         return get_ref_heat_resource(self._heat_resource, "network_id")