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
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
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
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
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
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
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
def build_fabric_config(fab_id): build.build_config(fab_id) serializer = FabricSerializer(fabric.get_fabric(fab_id)) return serializer.data
def get_fabric(fab_id): fab = fabric.get_fabric(fab_id) serializer = FabricSerializer(fab) return serializer.data