Esempio n. 1
0
def test_create_icr_virtual():
    """Test Virtual Server creation."""
    virtual = IcrVirtualServer(
        default_route_domain=2,
        **cfg_test_icr_virtual
    )
    assert virtual
Esempio n. 2
0
def test_create_icr_virtual():
    """Test Virtual Server creation."""
    virtual = IcrVirtualServer(
        **cfg_test_icr_virtual
    )
    assert virtual
Esempio n. 3
0
    def refresh(self):
        """Refresh the internal cache with the BIG-IP state."""
        partition_filter = "$filter=partition+eq+{}".format(self._partition)

        #  Retrieve the list of virtual servers in managed partition.
        query = partition_filter

        #  Retrieve the lists of health monitors
        http_monitors = self.tm.ltm.monitor.https.get_collection(
            requests_params={"params": query})
        https_monitors = self.tm.ltm.monitor.https_s.get_collection(
            requests_params={"params": query})
        tcp_monitors = self.tm.ltm.monitor.tcps.get_collection(
            requests_params={"params": query})
        icmp_monitors = (
            self.tm.ltm.monitor.gateway_icmps.get_collection(
                requests_params={"params": query})
        )
        iapps = self.tm.sys.application.services.get_collection(
            requests_params={"params": query})
        nodes = self.tm.ltm.nodes.get_collection(
            requests_params={"params": query})
        virtual_addresses = self.tm.ltm.virtual_address_s.get_collection(
            requests_params={"params": query})

        #  Retrieve the list of virtuals, pools, and policies in the
        #  managed partition getting all subCollections.
        query = "{}&expandSubcollections=true".format(partition_filter)
        virtuals = self.tm.ltm.virtuals.get_collection(
            requests_params={"params": query})

        pools = self.tm.ltm.pools.get_collection(
            requests_params={"params": query})

        policies = self.tm.ltm.policys.get_collection(
            requests_params={"params": query})

        #  Refresh the virtuals cache.
        self._virtuals = {
            v.name: IcrVirtualServer(**v.raw) for v in virtuals
            if self._manageable_resource(v)
        }

        #  Refresh the virtuals cache.
        self._all_virtuals = {
            v.name: IcrVirtualServer(**v.raw) for v in virtuals
        }

        #  Refresh the virtual address cache.
        self._virtual_addresses = {
            v.name: IcrVirtualAddress(**v.raw) for v in virtual_addresses
            if self._manageable_resource(v)
        }

        #  Refresh the pool cache
        self._pools = {
            p.name: IcrPool(**p.raw) for p in pools
            if self._manageable_resource(p)
        }

        #  Refresh the all-pool cache
        self._all_pools = {
            p.name: IcrPool(**p.raw) for p in pools
        }

        #  Refresh the policy cache
        self._policies = {
            p.name: IcrPolicy(**p.raw) for p in policies
            if self._manageable_resource(p)
        }

        #  Refresh the iapp cache
        self._iapps = {
            i.name: ApplicationService(**i.raw) for i in iapps
            if i.name.startswith(self._prefix)
        }

        #  Refresh the node cache
        self._nodes = {
            n.name: Node(**n.raw) for n in nodes
        }

        #  Refresh the health monitor cache
        self._monitors['http'] = {
            m.name: IcrHTTPMonitor(**m.raw) for m in http_monitors
            if self._manageable_resource(m)
        }
        self._monitors['https'] = {
            m.name: IcrHTTPSMonitor(**m.raw) for m in https_monitors
            if self._manageable_resource(m)
        }
        self._monitors['tcp'] = {
            m.name: IcrTCPMonitor(**m.raw) for m in tcp_monitors
            if self._manageable_resource(m)
        }
        self._monitors['icmp'] = {
            m.name: IcrICMPMonitor(**m.raw) for m in icmp_monitors
            if self._manageable_resource(m)
        }