Пример #1
0
                  (RouterPort
                   ({'portAddress': '10.1.0.1',
                     'networkAddress': '10.1.0.0',
                     'networkLength': 16,
                     'bgp':
                         Bgp({'localAS': 64513,
                              'peerAS': 64512,
                              'peerAddr': '10.1.0.240',
                              'adRoute':
                                  [AdRoute({'nwPrefix': '100.0.0.0',
                                            'prefixLength': 16})]})}),
                   HostInterface({'hostId': hosts[0],'name':'eth1'})),
                  (RouterPort
                   ({'portAddress': '10.2.0.1',
                     'networkAddress': '10.2.0.0',
                     'networkLength': 16,
                     'bgp':
                         Bgp({'localAS': 64514,
                              'peerAS': 64512,
                              'peerAddr': '10.2.0.240',
                              'adRoute':
                                  [AdRoute({'nwPrefix': '100.0.0.0',
                                            'prefixLength': 16})]})}),
                   HostInterface({'hostId': hosts[1],'name':'eth1'}))])
    except:
        traceback.print_exc()
        tx.rollback()

    # import pdb; pdb.set_trace()
    # tx.rollback()
Пример #2
0
                    delete_router(api,tx,router,peer.get_peer_id())

def delete_chain(api,tx,chain):
    tx.append(DeleteChain(api,chain))

if __name__ == '__main__':
    tenantIds = map(lambda tenant: tenant.id, list_tenants())

    api = MidonetApi('http://127.0.0.1:8080/midonet-api','admin','*')

    for tenantId in tenantIds:
        # router and its children (routers and bridges)
        tx = Transaction()
        for router in api.get_routers({'tenant_id': tenantId}):
            delete_router(api,tx,router)
        tx.rollback() # commit actually

        # dangling bridge
        tx = Transaction()
        for bridge in api.get_bridges({'tenant_id': tenantId}):
            delete_bridge(api,tx,bridge)
        tx.rollback()

        tx = Transaction()
        for chain in api.get_chains({'tenant_id': tenantId}):
            delete_chain(api,tx,chain)
        tx.rollback()

    tx = Transaction()
    for zone in api.get_tunnel_zones():
        tx.append(zone)
                  (RouterPort
                   ({'portAddress': '10.1.0.1',
                     'networkAddress': '10.1.0.0',
                     'networkLength': 16,
                     'bgp':
                         Bgp({'localAS': 64513,
                              'peerAS': 64512,
                              'peerAddr': '10.1.0.240',
                              'adRoute':
                                  [AdRoute({'nwPrefix': '100.0.0.0',
                                            'prefixLength': 16})]})}),
                   HostInterface({'hostId': hosts[0],'name':'eth1'})),
                  (RouterPort
                   ({'portAddress': '10.2.0.1',
                     'networkAddress': '10.2.0.0',
                     'networkLength': 16,
                     'bgp':
                         Bgp({'localAS': 64514,
                              'peerAS': 64512,
                              'peerAddr': '10.2.0.240',
                              'adRoute':
                                  [AdRoute({'nwPrefix': '100.0.0.0',
                                            'prefixLength': 16})]})}),
                   HostInterface({'hostId': hosts[1],'name':'eth1'}))])
    except:
        traceback.print_exc()
        tx.rollback()

    # import pdb; pdb.set_trace()
    # tx.rollback()
Пример #4
0
def delete_chain(api, tx, chain):
    tx.append(DeleteChain(api, chain))


if __name__ == '__main__':
    tenantIds = map(lambda tenant: tenant.id, list_tenants())

    api = MidonetApi('http://127.0.0.1:8080/midonet-api', 'admin', '*')

    for tenantId in tenantIds:
        # router and its children (routers and bridges)
        tx = Transaction()
        for router in api.get_routers({'tenant_id': tenantId}):
            delete_router(api, tx, router)
        tx.rollback()  # commit actually

        # dangling bridge
        tx = Transaction()
        for bridge in api.get_bridges({'tenant_id': tenantId}):
            delete_bridge(api, tx, bridge)
        tx.rollback()

        tx = Transaction()
        for chain in api.get_chains({'tenant_id': tenantId}):
            delete_chain(api, tx, chain)
        tx.rollback()

    tx = Transaction()
    for zone in api.get_tunnel_zones():
        tx.append(zone)