Esempio n. 1
0
 def test_ex_destroy_pool_member(self):
     response = self.driver.ex_destroy_pool_member(
         member=DimensionDataPoolMember(
             id='',
             name='test',
             status=State.RUNNING,
             ip='1.2.3.4',
             port=80,
             node_id='3c207269-e75e-11e4-811f-005056806999'),
         destroy_node=False)
     self.assertTrue(response)
Esempio n. 2
0
 def test_ex_destroy_pool_member_with_node(self):
     response = self.driver.ex_destroy_pool_member(
         member=DimensionDataPoolMember(
             id='',
             name='test',
             status=State.RUNNING,
             ip='1.2.3.4',
             port=80,
             node_id='34de6ed6-46a4-4dae-a753-2f8d3840c6f9'),
         destroy_node=True)
     self.assertTrue(response)
Esempio n. 3
0
 def _to_member(self, element):
     port = findtext(element, 'port', TYPES_URN)
     if port is not None:
         port = int(port)
     pool_member = DimensionDataPoolMember(
         id=element.get('id'),
         name=element.find(fixxpath('node', TYPES_URN)).get('name'),
         status=findtext(element, 'state', TYPES_URN),
         node_id=element.find(fixxpath('node', TYPES_URN)).get('id'),
         ip=element.find(fixxpath('node', TYPES_URN)).get('ipAddress'),
         port=port)
     return pool_member
Esempio n. 4
0
 def _to_member(self, element):
     port = findtext(element, "port", TYPES_URN)
     if port is not None:
         port = int(port)
     pool_member = DimensionDataPoolMember(
         id=element.get("id"),
         name=element.find(fixxpath("node", TYPES_URN)).get("name"),
         status=findtext(element, "state", TYPES_URN),
         node_id=element.find(fixxpath("node", TYPES_URN)).get("id"),
         ip=element.find(fixxpath("node", TYPES_URN)).get("ipAddress"),
         port=port,
     )
     return pool_member
 def test_ex_destroy_pool_member_with_node(self):
     response = self.driver.ex_destroy_pool_member(
         member=DimensionDataPoolMember(
             id="",
             name="test",
             status=State.RUNNING,
             ip="1.2.3.4",
             port=80,
             node_id="34de6ed6-46a4-4dae-a753-2f8d3840c6f9",
         ),
         destroy_node=True,
     )
     self.assertTrue(response)
 def test_ex_destroy_pool_member(self):
     response = self.driver.ex_destroy_pool_member(
         member=DimensionDataPoolMember(
             id="",
             name="test",
             status=State.RUNNING,
             ip="1.2.3.4",
             port=80,
             node_id="3c207269-e75e-11e4-811f-005056806999",
         ),
         destroy_node=False,
     )
     self.assertTrue(response)
Esempio n. 7
0
    def ex_create_pool_member(self, pool, node, port=None):
        """
        Create a new member in an existing pool from an existing node

        :param pool: Instance of ``DimensionDataPool`` (required)
        :type  pool: ``DimensionDataPool``

        :param node: Instance of ``DimensionDataVIPNode`` (required)
        :type  node: ``DimensionDataVIPNode``

        :param port: Port the the service will listen on
        :type  port: ``str``

        :return: The node member, instance of ``DimensionDataPoolMember``
        :rtype: ``DimensionDataPoolMember``
        """
        create_pool_m = ET.Element("addPoolMember", {"xmlns": TYPES_URN})
        ET.SubElement(create_pool_m, "poolId").text = pool.id
        ET.SubElement(create_pool_m, "nodeId").text = node.id
        if port is not None:
            ET.SubElement(create_pool_m, "port").text = str(port)
        ET.SubElement(create_pool_m, "status").text = "ENABLED"

        response = self.connection.request_with_orgId_api_2(
            "networkDomainVip/addPoolMember",
            method="POST",
            data=ET.tostring(create_pool_m),
        ).object

        member_id = None
        node_name = None
        for info in findall(response, "info", TYPES_URN):
            if info.get("name") == "poolMemberId":
                member_id = info.get("value")
            if info.get("name") == "nodeName":
                node_name = info.get("value")

        return DimensionDataPoolMember(
            id=member_id,
            name=node_name,
            status=State.RUNNING,
            ip=node.ip,
            port=port,
            node_id=node.id,
        )
Esempio n. 8
0
    def ex_create_pool_member(self, pool, node, port):
        """
        Create a new member in an existing pool from an existing node

        :param pool: Instance of ``DimensionDataPool`` (required)
        :type  pool: ``DimensionDataPool``

        :param node: Instance of ``DimensionDataVIPNode`` (required)
        :type  node: ``DimensionDataVIPNode``

        :param port: Port the the service will listen on
        :type  port: ``str``

        :return: The node member, instance of ``DimensionDataPoolMember``
        :rtype: ``DimensionDataPoolMember``
        """
        create_pool_m = ET.Element('addPoolMember', {'xmlns': TYPES_URN})
        ET.SubElement(create_pool_m, "poolId").text = pool.id
        ET.SubElement(create_pool_m, "nodeId").text = node.id
        ET.SubElement(create_pool_m, "status").text = 'ENABLED'

        response = self.connection.request_with_orgId_api_2(
            'networkDomainVip/addPoolMember',
            method='POST',
            data=ET.tostring(create_pool_m)).object

        member_id = None
        node_name = None
        for info in findall(response, 'info', TYPES_URN):
            if info.get('name') == 'poolMemberId':
                member_id = info.get('value')
            if info.get('name') == 'nodeName':
                node_name = info.get('value')

        return DimensionDataPoolMember(
            id=member_id,
            name=node_name,
            status=State.RUNNING,
            ip=node.ip,
            port=port,
            node_id=node.id
        )