Пример #1
0
def delete(ve, master_engine):
    #Delete easily. Just load the engine resource and call delete. Delete VE's first.
    #All elements descend from smc.base.model.Element
    #Note: Most operations will return an instance of smc.api.web.SMCResult so you 
    #can view the return attributes if necessary.
    ve = Engine('layer3-ve').load()
    ve.delete()
    
    master = Engine('engine-cluster').load()
    master.delete()
def remove_smc_engines(engine_name, public_ip, private_ip):
    session_login()
    MASK = '255.255.255.0'
    engine = Engine(engine_name)
    routes = RouteVPN.objects.all()
    gateways_to_delete = []
    for route in list(routes):
        route_name = route.name
        if engine_name in route_name:
            RouteVPN().get(route_name).delete()
            gateways_to_delete.append((route_name.split(engine_name)[-1])[1:])
    engine.delete()
    for gw in gateways_to_delete:
        ExternalGateway.get(gw).delete()
    public_base = MyIPv4(public_ip) & MyIPv4(MASK)
    public_network = string_to_ip(str(public_base) + '/24')
    Network.get(f'awsnetwork-{public_network}').delete()
    session.logout()
Пример #3
0
    # Retrieve the Engine
    print("Get cloud fw...")
    engine = Engine("Cloud Single firewall 1")
    print(list(engine.nodes))

    print("======================================================================================")
    print("Firewall name: %s" % engine)
    print("Firewall REF: %s" % engine.href)
    for node in engine.nodes:
        print("Firewall nodes: %s" % node)
        print("Firewall nodes: %s" % node.href)
    print("======================================================================================")

    # Check node status
    print("Get node status...")
    for node in engine.nodes:
        print("Firewall node %s status: %s" % (node.name, str(node.status())))

    # Delete Engine
    engine.delete()

except Exception as e:
    print("Example failed:" + str(e))
    engine = Engine("Cloud Single firewall 1")
    engine.delete()
    session.logout()
    exit(1)

session.logout()