示例#1
0
def update_fabric_switch(fab_id, switch_id, data, user=""):
    serializer = FabricSwitchPutSerializer(data=data)
    if not serializer.is_valid():
        raise IgniteException(serializer.errors)
    fabric.update_switch(fab_id, switch_id, serializer.data, user)
    serializer = FabricSerializer(fabric.get_fabric(fab_id))
    return serializer.data
示例#2
0
def add_fabric_switch(fab_id, data, user=""):
    serializer = SwitchPostSerializer(data=data)
    if not serializer.is_valid():
        raise IgniteException(serializer.errors)
    fabric.add_switches(fab_id, serializer.data, user)
    serializer = FabricSerializer(fabric.get_fabric(fab_id))
    return serializer.data
示例#3
0
def update_fabric_defaults(fab_id, data, user=""):
    serializer = TopologyPostDefaultsSerializer(data=data)
    if not serializer.is_valid():
        raise IgniteException(serializer.errors)

    fabric.update_defaults(fab_id, serializer.data, user)
    serializer = FabricSerializer(fabric.get_fabric(fab_id))
    return serializer.data
示例#4
0
def update_fabric_link(fab_id, link_id, data, user):
    serializer = LinkPutSerializer(data=data)
    if not serializer.is_valid():
        raise IgniteException(serializer.errors)

    fabric.update_link(fab_id, link_id, serializer.data, user)
    serializer = FabricSerializer(fabric.get_fabric(fab_id))
    return serializer.data
示例#5
0
def discover_fabric_post(data):
    serializer = DiscoveryPostSerializer(data=data)
    if not serializer.is_valid():
        raise IgniteException(serializer.errors)

    fab_id = fabric.create_empty_fabric(serializer.data)
    fabric.get_discovery(fab_id, serializer.data)
    fab = fabric.get_fabric(fab_id)
    serializer = FabricSerializer(fab)
    return serializer.data
示例#6
0
def build_fabric_config(fab_id):
    build.build_config(fab_id)
    serializer = FabricSerializer(fabric.get_fabric(fab_id))
    return serializer.data
示例#7
0
def delete_fabric_link(fab_id, link_id, user=""):
    fabric.delete_link(fab_id, link_id, user)
    serializer = FabricSerializer(fabric.get_fabric(fab_id))
    return serializer.data
示例#8
0
def decommission_fabric_switch(fab_id, switch_id, user=""):
    fabric.decommission_switch(fab_id, switch_id, user)
    serializer = FabricSerializer(fabric.get_fabric(fab_id))
    return serializer.data
示例#9
0
def get_fabric(fab_id):
    fab = fabric.get_fabric(fab_id)
    serializer = FabricSerializer(fab)
    return serializer.data