コード例 #1
0
    def unconsume_exported_contract(self, epg_name):
        session = self._login_session(SITE2_URL, SITE2_LOGIN, SITE2_PASSWORD)

        # Create the Tenant
        tenant = Tenant('multisite')
        # Create the Application Profile
        app = AppProfile('my-demo-app', tenant)
        # Create the EPGs
        web_epg = EPG(epg_name, app)
        contract = Contract('Site1:multisite_mysqlcontract', tenant)
        web_epg.consume(contract)
        web_epg.dont_consume(contract)
        resp = tenant.push_to_apic(session)
        if not resp.ok:
            print resp, resp.text
            self.assertTrue(resp.ok)
コード例 #2
0
    def unconsume_exported_contract(self, epg_name):
        session = self._login_session(SITE2_URL, SITE2_LOGIN, SITE2_PASSWORD)

        # Create the Tenant
        tenant = Tenant('multisite')
        # Create the Application Profile
        app = AppProfile('my-demo-app', tenant)
        # Create the EPGs
        web_epg = EPG(epg_name, app)
        contract = Contract('Site1:multisite_mysqlcontract', tenant)
        web_epg.consume(contract)
        web_epg.dont_consume(contract)
        resp = tenant.push_to_apic(session)
        if not resp.ok:
            print resp, resp.text
            self.assertTrue(resp.ok)
コード例 #3
0
def dettach_epg_provide_contract(tenant_name, ap_name, epg_name, provided_contract="", consumed_contract=""):
    session = Session(config_data.get('url'), config_data.get('login'), config_data.get('password'))
    resp = session.login()
    if not resp.ok:
        print('%% Could not login to APIC')

    tenant = Tenant(tenant_name)
    ap = AppProfile(ap_name, tenant)
    epg = EPG(epg_name, ap)
    if provided_contract:
        provided_contract = Contract(provided_contract, tenant)
        epg.dont_provide(provided_contract)
    if consumed_contract:
        consumed_contract = Contract(consumed_contract, tenant)
        epg.dont_consume(consumed_contract)
    resp = tenant.push_to_apic(session)

    if not resp.ok:
        print('%% Error: Could not push configuration to APIC')
        print(resp.text)