pyhpecw7.features.vxlan module¶
Manage VXLAN configurations on HPCOM7 devices.
-
class
pyhpecw7.features.vxlan.
L2EthService
(device, interface, instance, vsi)[source]¶ Bases:
object
- This class is used to get data and configure Ethernet Service Instances
- on Layer 2 interfaces, map to VSI, and perform equiv of xconnect.
Parameters: - device (HPCOM7) – connected instance of a
pyhpecw7.comware.HPCOM7
object. - interface (str) – name of a Layer 2 interface
- instance (str) – service instance ID to be configured on the interface
- vsi (str) – name of the VSI being mapped to the instance
-
interface
¶ name of a Layer 2 interface
Type: str
-
instance
¶ service instance ID to be configured on the interface
Type: str
-
vsi
¶ name of the VSI being mapped to the instance
Type: str
-
RV_VALUE_MAP
= None¶ supported value definition when using Ansible encapsulation default - 1 encapsulation s-vid VLAN_ID - 4, but adds SVlanRange key as VLAN_ID encapsulation s-vid VLAN_ID only-tagged - 5,
but adds SVlanRange key as VLAN_IDencapsulation tagged - 3 encapsulation untagged - 2
-
build
(stage=False, **kvargs)[source]¶ Builds service instance (and xconn) config object for an interface :param state: “present” or “absent” :type state: str :param kvargs: see Keyword Args
Keyword Arguments: - vsi (str) – OPTIONAL - name of VSI
- instance (str) – OPTIONAL - instance ID
- encap (str) – REQUIRED - [‘default’, ‘untagged’, ‘tagged’, ‘s-vid’, ‘only-tagged’]
- vlanid (str) – REQUIRED when
encap
set to “only-tagged” or “s-vid” - access_mode (str) – OPTIONAL - “vlan” or “ethernet”
Note: when encap is set to only-tagged, it also ensures s-vid
-
get_config
()[source]¶ - Get config of a service instance on a given interface for a
- given VSI
Returns: If the mapping exists, it returns a dictionary with the following key/value pairs: index (str): value of IfIndex interface (str): name of interface vsi (str): name of VSI instance (str): instance ID encap (str): [‘default’, ‘untagged’, ‘tagged’, ‘s-vid’, ‘only-tagged’] vlanid (str): vlanid PRESENT when encap
set to “only-tagged” or “s-vid”access_mode (str): ”vlan” or “ethernet”
-
get_vsi_encap
()[source]¶ Gets encap configuration for a given VXLAN ID
Returns: If a config exists, it returns a dictionary with the following key/value pairs: index (str): value of IfIndex instance (str): instance ID encap (str): [‘default’, ‘untagged’, ‘tagged’, ‘s-vid’, ‘only-tagged’] vlanid (str): vlanid PRESENT when encap
set to “only-tagged” or “s-vid”
-
get_vsi_map
()[source]¶ Get xconnect config for given interface and service instance
Returns: If the mapping exists, it returns a dictionary with the following key/value pairs: index (str): value of IfIndex vsi (str): name of VSI interface (str): name of interface instance (str): instance ID access_mode (str): ”vlan” or “ethernet”
-
class
pyhpecw7.features.vxlan.
Tunnel
(device, tunnel)[source]¶ Bases:
object
This class is used to get data and configure VXLAN tunnel interfaces.
Parameters: - device (HPCOM7) – connected instance of a
pyhpecw7.comware.HPCOM7
object. - tunnel (str) – Tunnel ID
-
tunnel
¶ Tunnel ID
Type: str
-
build
(stage=False, **kvargs)[source]¶ Stage or execute config object to create/update tunnel
Parameters: stage (bool) – whether to stage the command or execute immediately Returns: True if stage=True and successfully staged CLI response strings if immediate execution
-
get_config
()[source]¶ Get running config for a tunnel interface
Returns: - src (str): source IP addr of tunnel
- dest (str): destination IP addr of tunnel mode (str): mode of tunnel
If the tunnel does not exist, an empty dictionary is returned.
Return type: A dictionary is returned with the following k/v pairs
- device (HPCOM7) – connected instance of a
-
class
pyhpecw7.features.vxlan.
Vxlan
(device, vxlan, vsi=None)[source]¶ Bases:
object
This class is used to get data and configure VXLAN/VSI mappings.
Parameters: - device (HPCOM7) – connected instance of a
pyhpecw7.comware.HPCOM7
object. - vxlan (str) – VXLAN ID
- vsi (str) – name of the VSI
-
vxlan
¶ VXLAN ID
Type: str
-
vsi
¶ name of the VSI
Type: str
-
build
(stage=False, **kvargs)[source]¶ Stage or execute config for managing tunnels
Parameters: - state (str) – “present” or “absent”
- kvargs – see Keyword Args
- stage (bool) – whether to stage the command or execute immediately
Keyword Arguments: - tunnels_to_add (list) – OPTIONAL - tunnels to add to the VXLAN/VSI mapping
- tunnels_to_remove (list) – OPTIONAL - tunnels to remove to the VXLAN/VSI mapping
Returns: True if stage=True and successfully staged List of etree.Element XML responses if immediately executed
-
create
(stage=False)[source]¶ Stage or execute a config for creating a VSI
Parameters: stage (bool) – whether to stage the command or execute immediately Returns: True if stage=True and successfully staged List of etree.Element XML responses if immediately executed
-
get_config
()[source]¶ Get associated VSI for a given VXLAN ID along with configured tunnels for that given VXLAN/VSI mapping.
Returns: vxlan (str): vxlan id :vsi (str): name of vsi If the mapping does not exist, an empty dictionary is returned.
Return type: Dictionary with the following key/value pairs
-
get_tunnels
()[source]¶ Get a list of tunnel interface that are mapped to a given VXLAN ID
Returns: List of tunnel IDs
- device (HPCOM7) – connected instance of a