switchmng.database package¶
Submodules¶
switchmng.database.add module¶
-
switchmng.database.add.add_connector(session, **kwargs)¶ Create a new connector and add it to the database.
- Parameters
kwargs – Parameters for new connector. Possible parameters are public attributes of
Connectorobject but in a json compatible representation (as nested dict structure)- Return type
- Returns
The newly added connector
-
switchmng.database.add.add_network_protocol(session, **kwargs)¶ Create a new network protocol and add it to the database.
- Parameters
kwargs – Parameters for new network protocol. Possible parameters are public attributes of
NetworkProtocolobject but in a json compatible representation (as nested dict structure)- Return type
- Returns
The newly added network protocol
-
switchmng.database.add.add_port_model(session, switch_model_resource_id, **kwargs)¶ Add a new port model to a switch model and add it to the database.
- Parameters
switch_model_resource_id (
str) – Resource identifier uniquely identifying the switch model to add the new port model to. (SeeSwitchModelfor what attribute is the resource identifier)kwargs – Parameters for new port model. Possible parameters are public attributes of
PortModelobject but in a json compatible representation (as nested dict structure)
- Return type
- Returns
The newly added port model
-
switchmng.database.add.add_switch(session, **kwargs)¶ Create a new switch and add it to the database.
- Parameters
kwargs – Parameters for new switch. Possible parameters are public attributes of
Switchobject but in a json compatible representation (as nested dict structure)- Return type
- Returns
The newly added switch
-
switchmng.database.add.add_switch_model(session, **kwargs)¶ Create a new switch model and add it to the database.
- Parameters
kwargs – Parameters for new switch model. Possible parameters are public attributes of
SwitchModelobject but in a json compatible representation (as nested dict structure)- Return type
- Returns
The newly added switch model
-
switchmng.database.add.add_vlan(session, **kwargs)¶ Create a new vlan and add it to the database.
- Parameters
kwargs – Parameters for new vlan. Possible parameters are public attributes of
Vlanobject but in a json compatible representation (as nested dict structure)- Return type
- Returns
The newly added vlan
switchmng.database.delete module¶
-
switchmng.database.delete.delete_connector(session, resource_id)¶ Delete a connector from the database.
Can only delete a connector from the database if it is not still in use by a port of a switch model. Will only delete connector if there is not still a switch model which uses the given connector on one of its ports.
- Parameters
resource_id (
str) – Resource identifier uniquely identifying the connector to delete. (SeeConnectorfor what attribute is the resource identifier)- Return type
None
-
switchmng.database.delete.delete_network_protocol(session, resource_id)¶ Delete a network protocol from the database.
Can only delete a network protocol from the database if it is not still in use by a port of a switch model. Will only delete network protocol if there is not still a switch model which uses the given network protocol on one of its ports.
- Parameters
resource_id (
str) – Resource identifier uniquely identifying the network protocol to delete. (SeeNetworkProtocolfor what attribute is the resource identifier)- Return type
None
-
switchmng.database.delete.delete_port_model(session, switch_model_resource_id, port_model_resource_id)¶ Delete a port model from a switch model from the database.
- Parameters
switch_model_resource_id (
str) – Resource identifier uniquely identifying the switch model containing the port model to delete. (SeeSwitchModelfor what attribute is the resource identifier)port_model_resource_id (
str) – Resource identifier together with switch model uniquely identifying the port model to delete. (SeePortModelfor what attribute is the resource identifier)
- Return type
None
-
switchmng.database.delete.delete_switch(session, resource_id)¶ Delete a switch from the database.
- Parameters
resource_id (
str) – Resource identifier uniquely identifying the switch to delete. (SeeSwitchfor what attribute is the resource identifier)- Return type
None
-
switchmng.database.delete.delete_switch_model(session, resource_id)¶ Delete a switch model from the database.
Can only delete a switch model from the database if it is not still in use by a switch. Will only delete switch model if there is not still a switch which uses the given switch model as its model.
- Parameters
resource_id (
str) – Resource identifier uniquely identifying the switch model to delete. (SeeSwitchModelfor what attribute is the resource identifier)- Return type
None
-
switchmng.database.delete.delete_vlan(session, resource_id)¶ Delete a vlan from the database.
Can only delete a vlan from the database if it is not still in use by a port of a switch. Will only delete vlan if there is not still a switch which uses the given vlan on one of its ports.
- Parameters
resource_id (
str) – Resource identifier uniquely identifying the vlan to delete. (SeeVlanfor what attribute is the resource identifier)- Return type
None
switchmng.database.helper module¶
-
switchmng.database.helper.port_model_from_dict(session, **kwargs)¶ Create port model.
- Return type
switchmng.database.modify module¶
-
switchmng.database.modify.modify_connector(session, resource_id, **kwargs)¶ Modify a
Connectorobject in the database.All given attributes of connector will be modified. Attributes not given will not be changed and will keep their current state.
- Parameters
resource_id (
str) – Resource identifier uniquely identifying the connector to modifykwargs – Attributes of connector to change. Possible parameters are public attributes of
Connectorobject but in a json compatible representation (as nested dict structure)
- Return type
- Returns
The modified connector object
-
switchmng.database.modify.modify_network_protocol(session, resource_id, **kwargs)¶ Modify a
NetworkProtocolobject in the database.All given attributes of network protocol will be modified. Attributes not given will not be changed and will keep their current state.
- Parameters
resource_id (
str) – Resource identifier uniquely identifying the network protocol to modify. (SeeNetworkProtocolfor what attribute is the resource identifier)kwargs – Attributes of network protocol to change. Possible parameters are public attributes of
NetworkProtocolobject but in a json compatible representation (as nested dict structure)
- Return type
- Returns
The modified network protocol object
-
switchmng.database.modify.modify_port(session, switch_resource_id, port_resource_id, **kwargs)¶ Modify a
Portobject in the database.All given attributes of port will be modified. Attributes not given will not be changed and will keep their current state.
- Parameters
switch_resource_id (
str) – Resource identifier uniquely identifying the switch containing the port to modify. (SeeSwitchfor what attribute is the resource identifier)port_resource_id (
str) – Resource identifier together with switch uniquely identifying the port to modify. (SeePortfor what attribute is the resource identifier)kwargs – Attributes of port to change. Possible parameters are public attributes of
Portobject but in a json compatible representation (as nested dict structure)
- Return type
- Returns
The modified port
-
switchmng.database.modify.modify_port_model(session, switch_model_resource_id, port_model_resource_id, **kwargs)¶ Modify a
PortModelobject in the database.All given attributes of port model will be modified. Attributes not given will not be changed and will keep their current state.
- Parameters
switch_model_resource_id (
str) – Resource identifier uniquely identifying the switch model containing the port model to modify. (SeeSwitchModelfor what attribute is the resource identifier)port_model_resource_id (
str) – Resource identifier together with switch model uniquely identifying the port model to modify. (SeePortModelfor what attribute is the resource identifier)kwargs – Attributes of port model to change. Possible parameters are public attributes of
PortModelobject but in a json compatible representation (as nested dict structure)
- Return type
- Returns
The modified port model
-
switchmng.database.modify.modify_switch(session, resource_id, **kwargs)¶ Modify a
Switchobject in the database.All given attributes of switch will be modified. Attributes not given will not be changed and will keep their current state.
- Parameters
resource_id (
str) – Resource identifier uniquely identifying the switch to modify. (SeeSwitchfor what attribute is the resource identifier)kwargs – Attributes of switch to change. Possible parameters are public attributes of
Switchobject but in a json compatible representation (as nested dict structure)
- Return type
- Returns
The modified switch
-
switchmng.database.modify.modify_switch_model(session, resource_id, **kwargs)¶ Modify a
SwitchModelobject in the database.All given attributes of switch model will be modified. Attributes not given will not be changed and will keep their current state.
- Parameters
resource_id (
str) – Resource identifier uniquely identifying the switch model to modify. (SeeSwitchModelfor what attribute is the resource identifier)kwargs – Attributes of switch model to change. Possible parameters are public attributes of
SwitchModelobject but in a json compatible representation (as nested dict structure)
- Return type
- Returns
The modified switch model
-
switchmng.database.modify.modify_vlan(session, resource_id, **kwargs)¶ Modify a
Vlanobject in the database.All given attributes of vlan will be modified. Attributes not given will not be changed and will keep their current state.
- Parameters
resource_id (
str) – Resource identifier uniquely identifying the vlan to modify. (SeeVlanfor what attribute is the resource identifier)kwargs – Attributes of vlan to change. Possible parameters are public attributes of
Vlanobject but in a json compatible representation (as nested dict structure)
- Return type
- Returns
The modified vlan object
switchmng.database.query module¶
-
switchmng.database.query.query_connector(session, resource_id)¶ Retrieve
Connectorobject from database.Query the database for a
Connectorobject with given resource identifier and return it.- Parameters
resource_id (
str) – Resource identifier uniquely identifying the connector to return. (SeeConnectorfor what attribute is the resource identifier)- Return type
Optional[Connector]- Returns
The connector object matching the given resource identifier or None if no matching connector resource was found.
-
switchmng.database.query.query_connectors(session, **kwargs)¶ Retrieve multiple
Connectorobjects from database.# TODO: Implement and document query_connectors() correctly
-
switchmng.database.query.query_network_protocol(session, resource_id)¶ Retrieve
NetworkProtocolobject from database.Query the database for a
NetworkProtocolobject with given resource identifier and return it.- Parameters
resource_id (
str) – Resource identifier uniquely identifying the network protocol to return. (SeeNetworkProtocolfor what attribute is the resource identifier)- Return type
Optional[NetworkProtocol]- Returns
The network protocol object matching the given resource identifier or None if no matching network protocol resource was found.
-
switchmng.database.query.query_network_protocols(session, **kwargs)¶ Retrieve multiple
NetworkProtocolobjects from database.# TODO: Implement and document query_network_protocols() correctly
-
switchmng.database.query.query_port(session, switch_resource_id, port_resource_id)¶ Retrieve
Portobject from database.Query the database for a
Portobject with given resource identifier on switch with given resource identifier and return it.- Parameters
switch_resource_id (
str) – Resource identifier uniquely identifying the switch containing the port to return. (SeeSwitchfor what attribute is the resource identifier)port_resource_id (
str) – Resource identifier together with switch uniquely identifying the port to return. (SeePortfor what attribute is the resource identifier)
- Return type
Optional[Port]- Returns
The port object matching the given resource identifiers or None if no matching port resource was found.
-
switchmng.database.query.query_port_model(session, switch_model_resource_id, port_model_resource_id)¶ Retrieve
PortModelobject from database.Query the database for a
PortModelobject with given resource identifier on switch model with given resource identifier and return it.- Parameters
switch_model_resource_id (
str) – Resource identifier uniquely identifying the switch model containing the port model to return. (SeeSwitchModelfor what attribute is the resource identifier)port_model_resource_id (
str) – Resource identifier together with switch model uniquely identifying the port model to return. (SeePortModelfor what attribute is the resource identifier)
- Return type
Optional[PortModel]- Returns
The port model object matching the given resource identifiers or None if no matching port model resource was found.
-
switchmng.database.query.query_port_models(session, switch_model_resource_id, **kwargs)¶ Retrieve multiple
PortModelobjects from database.switch_model_resource_id is optional
# TODO: Implement and document query_port_models() correctly
-
switchmng.database.query.query_ports(session, switch_resource_id, **kwargs)¶ Retrieve multiple
Portobjects from database.switch_resource_id is optional
# TODO: Implement and document query_ports() correctly
-
switchmng.database.query.query_switch(session, resource_id)¶ Retrieve
Switchobject from database.Query the database for a
Switchobject with given resource identifier and return it.- Parameters
resource_id (
str) – Resource identifier uniquely identifying the switch to return. (SeeSwitchfor what attribute is the resource identifier)- Return type
Optional[Switch]- Returns
The switch object matching the given resource identifier or None if no matching switch resource was found.
-
switchmng.database.query.query_switch_model(session, resource_id)¶ Retrieve
SwitchModelobject from database.Query the database for a
SwitchModelobject with given resource identifier and return it.- Parameters
resource_id (
str) – Resource identifier uniquely identifying the switch model to return. (SeeSwitchModelfor what attribute is the resource identifier)- Return type
Optional[SwitchModel]- Returns
The switch model object matching the given resource identifier or None if no matching switch model resource was found.
-
switchmng.database.query.query_switch_models(session, **kwargs)¶ Retrieve multiple
SwitchModelobjects from database.# TODO: Implement and document query_switch_models() correctly
-
switchmng.database.query.query_switches(session, **kwargs)¶ Retrieve multiple
Switchobjects from database.# TODO: Implement and document query_switches() correctly
-
switchmng.database.query.query_vlan(session, resource_id)¶ Retrieve
Vlanobject from database.Query the database for a
Vlanobject with given resource identifier and return it.- Parameters
resource_id (
str) – Resource identifier uniquely identifying the vlan to return. (SeeVlanfor what attribute is the resource identifier)- Return type
Optional[Vlan]- Returns
The vlan object matching the given resource identifier or None if no matching vlan resource was found.
-
switchmng.database.query.query_vlans(session, **kwargs)¶ Retrieve multiple
Vlanobjects from database.# TODO: Implement and document query_vlans() correctly
switchmng.database.set module¶
-
switchmng.database.set.set_connector(session, resource_id, **kwargs)¶ Set a
Connectorin the database to a given state.Connectoridentified by given resource identifier may already exist. If it does not already exist it will be created.All attributes of connector will be set to given values. Attributes not given but present in already existing
Connectorwill be set to None or [] or other representation of “not set”.- Parameters
resource_id (
Optional[str]) – Resource identifier uniquely identifying the connector to modify. (SeeConnectorfor what attribute is the resource identifier)kwargs – Attributes of connector to change. Possible parameters are public attributes of
Connectorobject but in a json compatible representation (as nested dict structure)
- Return type
- Returns
The modified or created connector
-
switchmng.database.set.set_network_protocol(session, resource_id, **kwargs)¶ Set a
NetworkProtocolin the database to a given state.NetworkProtocolidentified by given resource identifier may already exist. If it does not already exist it will be created.All attributes of network protocol will be set to given values. Attributes not given but present in already existing
NetworkProtocolwill be set to None or [] or other representation of “not set”.- Parameters
resource_id (
Optional[str]) – Resource identifier uniquely identifying the network protocol to modify. (SeeNetworkProtocolfor what attribute is the resource identifier)kwargs – Attributes of network protocol to change. Possible parameters are public attributes of
NetworkProtocolobject but in a json compatible representation (as nested dict structure)
- Return type
- Returns
The modified or created network protocol
-
switchmng.database.set.set_port(session, switch_resource_id, port_resource_id, **kwargs)¶ Set a
Portin the database to a given state.Portidentified by given resource identifier on switch identified by given resource identifier may already exist. If it does not already exist it will be created.All attributes of port will be set to given values. Attributes not given but present in already existing
Portwill be set to None or [] or other representation of “not set”.- Parameters
switch_resource_id (
str) – Resource identifier uniquely identifying the switch containing the port to modify. (SeeSwitchfor what attribute is the resource identifier)port_resource_id (
str) – Resource identifier together with switch uniquely identifying the port to modify. (SeePortfor what attribute is the resource identifier)kwargs – Attributes of port to change. Possible parameters are public attributes of
Portobject but in a json compatible representation (as nested dict structure)
- Return type
- Returns
The modified or created port
-
switchmng.database.set.set_port_model(session, switch_model_resource_id, port_model_resource_id, **kwargs)¶ Set a
PortModelin the database to a given state.PortModelidentified by given resource identifier on switch model identified by given resource identifier may already exist. If it does not already exist it will be created.All attributes of port model will be set to given values. Attributes not given but present in already existing
PortModelwill be set to None or [] or other representation of “not set”.- Parameters
switch_model_resource_id (
str) – Resource identifier uniquely identifying the switch model containing the port model to modify. (SeeSwitchModelfor what attribute is the resource identifier)port_model_resource_id (
str) – Resource identifier together with switch model uniquely identifying the port model to modify. (SeePortModelfor what attribute is the resource identifier)kwargs – Attributes of port model to change. Possible parameters are public attributes of
PortModelobject but in a json compatible representation (as nested dict structure)
- Return type
- Returns
The modified or created port model
-
switchmng.database.set.set_switch(session, resource_id, **kwargs)¶ Set a
Switchcorresponding to a given resource identifier to a given state.Switchidentified by given resource identifier may already exist. If it does not already exist it will be created.All attributes of switch will be set to given values. Attributes not given but present in already existing
Switchwill be set to None or [] or other representation of “not set”.- Parameters
resource_id (
Optional[str]) – Resource identifier uniquely identifying the switch to modify. (SeeSwitchfor what attribute is the resource identifier)kwargs – Attributes of switch to change. Possible parameters are public attributes of
Switchobject but in a json compatible representation (as nested dict structure)
- Return type
- Returns
The modified or created switch
-
switchmng.database.set.set_switch_model(session, resource_id, **kwargs)¶ Set a
SwitchModelin the database to a given state.SwitchModelidentified by given resource identifier may already exist. If it does not already exist it will be created.All attributes of switch model will be set to given values. Attributes not given but present in already existing
SwitchModelwill be set to None or [] or other representation of “not set”.- Parameters
resource_id (
Optional[str]) – Resource identifier uniquely identifying the switch model to modify. (SeeSwitchModelfor what attribute is the resource identifier)kwargs – Attributes of switch model to change. Possible parameters are public attributes of
SwitchModelobject but in a json compatible representation (as nested dict structure)
- Return type
- Returns
The modified or created switch model
-
switchmng.database.set.set_vlan(session, resource_id, **kwargs)¶ Set a
Vlanin the database to a given state.Vlanidentified by given resource identifier may already exist. If it does not already exist it will be created.All attributes of vlan will be set to given values. Attributes not given but present in already existing
Vlanwill be set to None or [] or other representation of “not set”.- Parameters
resource_id (
Optional[str]) – Resource identifier uniquely identifying the vlan to modify. (SeeVlanfor what attribute is the resource identifier)kwargs – Attributes of vlan to change. Possible parameters are public attributes of
Vlanobject but in a json compatible representation (as nested dict structure)
- Return type
- Returns
The modified or created vlan