pynos.versions.base package

Submodules

pynos.versions.base.bgp module

Copyright 2015 Brocade Communications Systems, Inc.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class pynos.versions.base.bgp.BGP(callback)[source]

Bases: object

The BGP class holds all relevent methods and attributes for the BGP capabilities of the NOS device.

None
enable_peer_bfd(**kwargs)[source]
enabled

boolTrue if BGP is enabled; False if BGP is disabled.

get_bgp_neighbors(**kwargs)[source]

Get BGP neighbors configured on a device.

Parameters:
  • rbridge_id (str) – The rbridge ID of the device on which BGP will be configured in a VCS fabric.
  • vrf (str) – The VRF for this BGP process.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

List of 0 or more BGP Neighbors on the specified rbridge.

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.bgp.local_asn(local_as='65535',
...     rbridge_id='225')
...     output = dev.bgp.neighbor(ip_addr='10.10.10.10',
...     remote_as='65535', rbridge_id='225')
...     output = dev.bgp.neighbor(remote_as='65535',
...     rbridge_id='225',
...     ip_addr='2001:4818:f000:1ab:cafe:beef:1000:1')
...     result = dev.bgp.get_bgp_neighbors(rbridge_id='225')
...     assert len(result) >= 1
...     output = dev.bgp.neighbor(ip_addr='10.10.10.10',
...     delete=True, rbridge_id='225')
...     output = dev.bgp.neighbor(delete=True, rbridge_id='225',
...     ip_addr='2001:4818:f000:1ab:cafe:beef:1000:1')
...     dev.bgp.neighbor() 
Traceback (most recent call last):
NotImplementedError
KeyError
graceful_restart(**kwargs)[source]

Set BGP next hop recursion property.

Parameters:
  • vrf (str) – The VRF for this BGP process.
  • rbridge_id (str) – The rbridge ID of the device on which BGP will be configured in a VCS fabric.
  • afi (str) – Address family to configure. (ipv4, ipv6)
  • get (bool) – Get config instead of editing config. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:

AttributeError: When afi is not one of [‘ipv4’, ‘ipv6’]

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.bgp.graceful_restart(rbridge_id='225')
...     output = dev.bgp.graceful_restart(rbridge_id='225',
...     get=True)
...     output = dev.bgp.graceful_restart(rbridge_id='225',
...     delete=True)
...     output = dev.bgp.graceful_restart(rbridge_id='225',
...     afi='ipv6')
...     output = dev.bgp.graceful_restart(rbridge_id='225',
...     afi='ipv6', get=True)
...     output = dev.bgp.graceful_restart(rbridge_id='225',
...     afi='ipv6', delete=True)
...     output = dev.bgp.graceful_restart(rbridge_id='225',
...     afi='ipv5') 
Traceback (most recent call last):
AttributeError
local_asn(**kwargs)[source]

Set BGP local ASN.

Parameters:
  • local_as (str) – Local ASN of NOS deice.
  • vrf (str) – The VRF for this BGP process.
  • rbridge_id (str) – The rbridge ID of the device on which BGP will be configured in a VCS fabric.
  • get (bool) – Get config instead of editing config. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:

KeyError – if local_as is not specified.

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.bgp.local_asn(local_as='65535',
...     rbridge_id='225')
...     output = dev.bgp.local_asn(local_as='65535',
...     rbridge_id='225', get=True)
...     dev.bgp.local_asn() 
Traceback (most recent call last):
KeyError
max_paths(**kwargs)[source]

Set BGP max paths property.

Parameters:
  • vrf (str) – The VRF for this BGP process.
  • rbridge_id (str) – The rbridge ID of the device on which BGP will be configured in a VCS fabric.
  • paths (str) – Number of paths for BGP ECMP (default: 8).
  • afi (str) – Address family to configure. (ipv4, ipv6)
  • get (bool) – Get config instead of editing config. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:

AttributeError: When afi is not one of [‘ipv4’, ‘ipv6’]

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.bgp.max_paths(paths='8',
...     rbridge_id='225')
...     output = dev.bgp.max_paths(paths='8',
...     rbridge_id='225', get=True)
...     output = dev.bgp.max_paths(paths='8',
...     rbridge_id='225', delete=True)
...     output = dev.bgp.max_paths(paths='8', afi='ipv6',
...     rbridge_id='225')
...     output = dev.bgp.max_paths(paths='8', afi='ipv6',
...     rbridge_id='225', get=True)
...     output = dev.bgp.max_paths(paths='8', afi='ipv6',
...     rbridge_id='225', delete=True)
...     output = dev.bgp.max_paths(paths='8', afi='ipv5',
...     rbridge_id='225') 
Traceback (most recent call last):
AttributeError
multihop(**kwargs)[source]

Set BGP multihop property for a neighbor.

Parameters:
  • vrf (str) – The VRF for this BGP process.
  • rbridge_id (str) – The rbridge ID of the device on which BGP will be configured in a VCS fabric.
  • neighbor (str) – Address family to configure. (ipv4, ipv6)
  • count (str) – Number of hops to allow. (1-255)
  • get (bool) – Get config instead of editing config. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • ``AttributeError``: When `neighbor` is not a valid IPv4 or IPv6 – address.
  • KeyError: When count is not specified.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.230']
>>> for switch in switches:
...     conn = (switch, '22')
...     auth = ('admin', 'password')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         dev.bgp.local_asn(local_as='65535', rbridge_id='225')
...         dev.bgp.neighbor(ip_addr='10.10.10.10',
...         remote_as='65535', rbridge_id='225')
...         dev.bgp.neighbor(remote_as='65535', rbridge_id='225',
...         ip_addr='2001:4818:f000:1ab:cafe:beef:1000:1')
...         dev.bgp.multihop(neighbor='10.10.10.10', count='5',
...         rbridge_id='225')
...         dev.bgp.multihop(get=True, neighbor='10.10.10.10',
...         count='5', rbridge_id='225')
...         dev.bgp.multihop(count='5', rbridge_id='225',
...         neighbor='2001:4818:f000:1ab:cafe:beef:1000:1')
...         dev.bgp.multihop(get=True, count='5', rbridge_id='225',
...         neighbor='2001:4818:f000:1ab:cafe:beef:1000:1')
...         dev.bgp.multihop(delete=True, neighbor='10.10.10.10',
...         count='5', rbridge_id='225')
...         dev.bgp.multihop(delete=True, count='5',
...         rbridge_id='225',
...         neighbor='2001:4818:f000:1ab:cafe:beef:1000:1')
...         dev.bgp.neighbor(ip_addr='10.10.10.10', delete=True,
...         rbridge_id='225')
...         dev.bgp.neighbor(delete=True, rbridge_id='225',
...         ip_addr='2001:4818:f000:1ab:cafe:beef:1000:1')
...         output = dev.bgp.multihop(rbridge_id='225', count='5')
...         
Traceback (most recent call last):
NotImplementedError
KeyError
neighbor(**kwargs)[source]

Add BGP neighbor.

Parameters:
  • ip_addr (str) – IP Address of BGP neighbor.
  • remote_as (str) – Remote ASN of BGP neighbor.
  • vrf (str) – The VRF for this BGP process.
  • rbridge_id (str) – The rbridge ID of the device on which BGP will be configured in a VCS fabric.
  • delete (bool) – Deletes the neighbor if delete is True.
  • get (bool) – Get config instead of editing config. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:

KeyError – if remote_as or ip_addr is not specified.

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.bgp.local_asn(local_as='65535',
...     rbridge_id='225')
...     output = dev.bgp.neighbor(ip_addr='10.10.10.10',
...     remote_as='65535', rbridge_id='225')
...     output = dev.bgp.neighbor(ip_addr='10.10.10.10', get=True,
...     remote_as='65535', rbridge_id='225')
...     output = dev.bgp.neighbor(remote_as='65535',
...     rbridge_id='225',
...     ip_addr='2001:4818:f000:1ab:cafe:beef:1000:1')
...     output = dev.bgp.neighbor(remote_as='65535', get=True,
...     rbridge_id='225',
...     ip_addr='2001:4818:f000:1ab:cafe:beef:1000:1')
...     output = dev.bgp.neighbor(ip_addr='10.10.10.10',
...     delete=True, rbridge_id='225')
...     output = dev.bgp.neighbor(delete=True, rbridge_id='225',
...     ip_addr='2001:4818:f000:1ab:cafe:beef:1000:1')
...     dev.bgp.neighbor() 
Traceback (most recent call last):
NotImplementedError
KeyError
peer_bfd(**kwargs)[source]
recursion(**kwargs)[source]

Set BGP next hop recursion property.

Parameters:
  • vrf (str) – The VRF for this BGP process.
  • rbridge_id (str) – The rbridge ID of the device on which BGP will be configured in a VCS fabric.
  • afi (str) – Address family to configure. (ipv4, ipv6)
  • get (bool) – Get config instead of editing config. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:

AttributeError: When afi is not one of [‘ipv4’, ‘ipv6’]

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.bgp.recursion(rbridge_id='225')
...     output = dev.bgp.recursion(rbridge_id='225', get=True)
...     output = dev.bgp.recursion(rbridge_id='225', delete=True)
...     output = dev.bgp.max_paths(rbridge_id='225', afi='ipv6')
...     output = dev.bgp.max_paths(rbridge_id='225', afi='ipv6',
...     get=True)
...     output = dev.bgp.max_paths(rbridge_id='225', afi='ipv6',
...     delete=True)
...     output = dev.bgp.max_paths(rbridge_id='225', afi='ipv5')
...     
Traceback (most recent call last):
AttributeError
...     output = dev.bgp.recursion(rbridge_id='225', afi='hodor')
...     
Traceback (most recent call last):
AttributeError
redistribute(**kwargs)[source]

Set BGP redistribute properties.

Parameters:
  • vrf (str) – The VRF for this BGP process.
  • rbridge_id (str) – The rbridge ID of the device on which BGP will be configured in a VCS fabric.
  • source (str) – Source for redistributing. (connected)
  • afi (str) – Address family to configure. (ipv4, ipv6)
  • get (bool) – Get config instead of editing config. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:

KeyError – if source is not specified.

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.bgp.redistribute(source='connected',
...     rbridge_id='225')
...     output = dev.bgp.redistribute(source='connected',
...     rbridge_id='225', get=True)
...     output = dev.bgp.redistribute(source='connected',
...     rbridge_id='225', delete=True)
...     dev.bgp.redistribute() 
Traceback (most recent call last):
KeyError
...     dev.bgp.redistribute(source='connected', rbridge_id='225',
...     afi='hodor') 
Traceback (most recent call last):
AttributeError
...     dev.bgp.redistribute(source='hodor', rbridge_id='225',
...     afi='ipv4') 
Traceback (most recent call last):
AttributeError
...     output = dev.bgp.redistribute(source='connected', afi='x',
...     rbridge_id='225') 
Traceback (most recent call last):
AttributeError
remove_bgp(**kwargs)[source]

Remove BGP process completely.

Parameters:
  • vrf (str) – The VRF for this BGP process.
  • rbridge_id (str) – The rbridge ID of the device on which BGP will be configured in a VCS fabric.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:

None

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.bgp.local_asn(local_as='65535',
...     rbridge_id='225')
...     output = dev.bgp.remove_bgp(rbridge_id='225')
update_source(**kwargs)[source]

Set BGP update source property for a neighbor.

This method currently only supports loopback interfaces.

Parameters:
  • vrf (str) – The VRF for this BGP process.
  • rbridge_id (str) – The rbridge ID of the device on which BGP will be configured in a VCS fabric.
  • neighbor (str) – Address family to configure. (ipv4, ipv6)
  • int_type (str) – Interface type (loopback)
  • int_name (str) – Interface identifier (1, 5, 7, etc)
  • get (bool) – Get config instead of editing config. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • ``AttributeError``: When `neighbor` is not a valid IPv4 or IPv6 – address.
  • KeyError: When int_type or int_name are not specified.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.230']
>>> for switch in switches:
...     conn = (switch, '22')
...     auth = ('admin', 'password')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         dev.interface.ip_address(int_type='loopback', name='6',
...         rbridge_id='225', ip_addr='6.6.6.6/32')
...         dev.interface.ip_address(int_type='loopback', name='6',
...         ip_addr='0:0:0:0:0:ffff:606:606/128', rbridge_id='225')
...         dev.bgp.local_asn(local_as='65535', rbridge_id='225')
...         dev.bgp.neighbor(ip_addr='10.10.10.10',
...         remote_as='65535', rbridge_id='225')
...         dev.bgp.neighbor(remote_as='65535', rbridge_id='225',
...         ip_addr='2001:4818:f000:1ab:cafe:beef:1000:1')
...         dev.bgp.update_source(neighbor='10.10.10.10',
...         rbridge_id='225', int_type='loopback', int_name='6')
...         dev.bgp.update_source(get=True, neighbor='10.10.10.10',
...         rbridge_id='225', int_type='loopback', int_name='6')
...         dev.bgp.update_source(rbridge_id='225', int_name='6',
...         neighbor='2001:4818:f000:1ab:cafe:beef:1000:1',
...         int_type='loopback')
...         dev.bgp.update_source(get=True, rbridge_id='225',
...         neighbor='2001:4818:f000:1ab:cafe:beef:1000:1',
...         int_type='loopback', int_name='6')
...         dev.bgp.update_source(neighbor='10.10.10.10',
...         rbridge_id='225', delete=True, int_type='loopback',
...         int_name='6')
...         dev.bgp.update_source(delete=True, int_type='loopback',
...         rbridge_id='225', int_name='6',
...         neighbor='2001:4818:f000:1ab:cafe:beef:1000:1')
...         dev.bgp.neighbor(ip_addr='10.10.10.10', delete=True,
...         rbridge_id='225')
...         dev.bgp.neighbor(delete=True, rbridge_id='225',
...         ip_addr='2001:4818:f000:1ab:cafe:beef:1000:1')
...         dev.interface.ip_address(int_type='loopback', name='6',
...         rbridge_id='225', ip_addr='6.6.6.6/32', delete=True)
...         dev.interface.ip_address(int_type='loopback', name='6',
...         ip_addr='0:0:0:0:0:ffff:606:606/128', rbridge_id='225',
...         delete=True)
...         output = dev.bgp.update_source(rbridge_id='225',
...         int_type='loopback')
...         
Traceback (most recent call last):
NotImplementedError
KeyError

pynos.versions.base.fabric_service module

Copyright 2015 Brocade Communications Systems, Inc.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class pynos.versions.base.fabric_service.FabricService(callback)[source]

Bases: object

FabricService class containing all VCS Fabric methods and attributes.

dict – trill link details

pynos.versions.base.firmware module

Copyright 2015 Brocade Communications Systems, Inc.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class pynos.versions.base.firmware.Firmware(callback)[source]

Bases: object

System class containing all system level methods and attributes.

download(protocol, host, user, password, file_name, rbridge='all')[source]

Download firmware to device

download_status(ip_address, session_id=None)[source]
static get_firmware_download_request(protocol, host, user_name, password, file_name, rbridge)[source]

pynos.versions.base.interface module

Copyright 2015 Brocade Communications Systems, Inc.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class pynos.versions.base.interface.Interface(callback)[source]

Bases: object

The Interface class holds all the actions assocaiated with the Interfaces of a NOS device.

None
acc_vlan(**kwargs)[source]

Set access VLAN on a port.

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, etc)
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc)
  • vlan (str) – VLAN ID to set as the access VLAN.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, or vlan is not specified.
  • ValueError – if int_type, name, or vlan is not valid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> int_type = 'tengigabitethernet'
>>> name = '225/0/30'
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.add_vlan_int('736')
...         output = dev.interface.enable_switchport(int_type,
...         name)
...         output = dev.interface.acc_vlan(int_type=int_type,
...         name=name, vlan='736')
...         dev.interface.acc_vlan()
...         
Traceback (most recent call last):
KeyError
access_vlan(inter_type, inter, vlan_id)[source]

Add a L2 Interface to a specific VLAN.

Parameters:
  • inter_type – The type of interface you want to configure. Ex. tengigabitethernet, gigabitethernet, fortygigabitethernet.
  • inter – The ID for the interface you want to configure. Ex. 1/0/1
  • vlan_id – ID for the VLAN interface being modified. Value of 2-4096.
Returns:

True if command completes successfully or False if not.

Raises:

None

add_int_vrf(**kwargs)[source]

Add L3 Interface in Vrf.

Parameters:
  • int_type – L3 interface type on which the vrf needs to be configured.
  • name – L3 interface name on which the vrf needs to be configured.
  • vrf_name – Vrf name with which the L3 interface needs to be associated.
  • enable (bool) – If vrf fowarding should be enabled or disabled.Default:True.
  • get (bool) – Get config instead of editing config. (True, False)
  • rbridge_id (str) – rbridge-id for device. Only required when type is ve.
  • callback (function) –

    A function executed upon completion of the method. The only parameter passed to callback will be the

    ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, vrf is not passed. (int_type need not be passed if get=True)
  • ValueError – if int_type, name, vrf is invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.add_int_vrf(
...         int_type='tengigabitethernet',
...         name='225/0/38',
...         vrf_name='100',
...         rbridge_id='1')
...         output = dev.interface.add_int_vrf(
...         get=True,int_type='tengigabitethernet',
...         name='225/0/38',
...         vrf_name='100',
...         rbridge_id='1')
...         output = dev.interface.add_int_vrf(
...         get=True, name='225/0/38',
...         rbridge_id='1')
...         output = dev.interface.add_int_vrf(
...         enable=False,int_type='tengigabitethernet',
...         name='225/0/39',
...         vrf_name='101',
...         rbridge_id='1')
...         
Traceback (most recent call last):
KeyError
add_vlan_int(vlan_id)[source]

Add VLAN Interface. VLAN interfaces are required for VLANs even when not wanting to use the interface for any L3 features.

Parameters:vlan_id – ID for the VLAN interface being created. Value of 2-4096.
Returns:True if command completes successfully or False if not.
Raises:None
admin_state(**kwargs)[source]

Set interface administrative state.

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, etc).
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc).
  • enabled (bool) – Is the interface enabled? (True, False)
  • rbridge_id (str) – rbridge-id for device. Only required when type is ve.
  • get (bool) – Get config instead of editing config. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, or enabled is not passed and get is not True.
  • ValueError – if int_type, name, or enabled are invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         dev.interface.admin_state(
...         int_type='tengigabitethernet', name='225/0/38',
...         enabled=False)
...         dev.interface.admin_state(
...         int_type='tengigabitethernet', name='225/0/38',
...         enabled=True)
...         output = dev.interface.add_vlan_int('87')
...         output = dev.interface.ip_address(int_type='ve',
...         name='87', ip_addr='10.0.0.1/24', rbridge_id='225')
...         output = dev.interface.admin_state(int_type='ve',
...         name='87', enabled=True, rbridge_id='225')
...         output = dev.interface.admin_state(int_type='ve',
...         name='87', enabled=False, rbridge_id='225')
...         output = dev.interface.ip_address(int_type='loopback',
...         name='225', ip_addr='10.225.225.225/32',
...         rbridge_id='225')
...         output = dev.interface.admin_state(int_type='loopback',
...         name='225', enabled=True, rbridge_id='225')
...         output = dev.interface.admin_state(int_type='loopback',
...         name='225', enabled=False, rbridge_id='225')
...         output = dev.interface.ip_address(int_type='loopback',
...         name='225', ip_addr='10.225.225.225/32',
...         rbridge_id='225', delete=True)
bfd(**kwargs)[source]
channel_group(**kwargs)[source]

set channel group mode.

Parameters:
  • int_type (str) – type of interface. (gigabitethernet, tengigabitethernet, etc)
  • name (str) – name of interface. (1/0/5, 1/0/10, etc)
  • port_int (str) – port-channel number (1, 2, 3, etc).
  • channel_type (str) – tiype of port-channel (standard, brocade)
  • mode (str) – mode of channel group (active, on, passive).
  • delete (bool) – Removes channel group configuration from this interface if delete is True.
  • callback (function) – a function executed upon completion of the method. the only parameter passed to callback will be the elementtree config.
Returns:

return value of callback.

Raises:
  • keyerror – if int_type, name, or description is not specified.
  • valueerror – if name or int_type are not valid values.

examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.channel_group(name='225/0/20',
...         int_type='tengigabitethernet',
...         port_int='1', channel_type='standard', mode='active')
...         dev.interface.channel_group()
...         
Traceback (most recent call last):
KeyError
conversational_mac(**kwargs)[source]

Enable conversational mac learning on vdx switches

Parameters:
  • get (bool) – Get config instead of editing config. (True, False)
  • delete (bool) – True, delete the mac-learning. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:

None

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.interface.conversational_mac()
...     output = dev.interface.conversational_mac(get=True)
...     output = dev.interface.conversational_mac(delete=True)
create_ve(**kwargs)[source]

Add Ve Interface . :param ve_name: Ve name with which the Ve interface needs to be

created.
Parameters:
  • enable (bool) – If vrf fowarding should be enabled or disabled.Default:True.
  • get (bool) – Get config instead of editing config. (True, False)
  • rbridge_id (str) – rbridge-id for device.
  • callback (function) –

    A function executed upon completion of the method. The only parameter passed to callback will be the

    ElementTree config.
Returns:

Return value of callback.

Raises:

ValueError – if ve_name is invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.create_ve(
 ...         ve_name='100',
...         rbridge_id='1')
...         output = dev.interface.create_ve(
...         get=True,
...         ve_name='100',
...         rbridge_id='1')
...         output = dev.interface.create_ve(
...         get=True,
...         rbridge_id='1')
...         output = dev.interface.create_ve(
...         enable=False,
...         ve_name='101',
...         rbridge_id='1')
...         
Traceback (most recent call last):
KeyError
del_access_vlan(inter_type, inter, vlan_id)[source]

Remove a L2 Interface from a specific VLAN, placing it back into the default VLAN.

Parameters:
  • inter_type – The type of interface you want to configure. Ex. tengigabitethernet, gigabitethernet, fortygigabitethernet.
  • inter – The ID for the interface you want to configure. Ex. 1/0/1
  • vlan_id – ID for the VLAN interface being modified. Value of 2-4096.
Returns:

True if command completes successfully or False if not.

Raises:

None

del_ip(inter_type, inter, ip_addr)[source]

Delete IP address from a L3 interface.

Parameters:
  • inter_type – The type of interface you want to configure. Ex. tengigabitethernet, gigabitethernet, fortygigabitethernet.
  • inter – The ID for the interface you want to configure. Ex. 1/0/1
  • ip_addr – IP Address in <prefix>/<bits> format. Ex: 10.10.10.1/24
Returns:

True if command completes successfully or False if not.

Raises:

None

del_vlan_int(vlan_id)[source]

Delete VLAN Interface.

Parameters:vlan_id – ID for the VLAN interface being created. Value of 2-4096.
Returns:True if command completes successfully or False if not.
Raises:None
description(**kwargs)[source]

Set interface description.

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, etc)
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc)
  • desc (str) – The description of the interface.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, or desc is not specified.
  • ValueError – if name, int_type, or desc is not a valid value.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.description(
...         int_type='tengigabitethernet',
...         name='225/0/38',
...         desc='test')
...         dev.interface.description()
...         
Traceback (most recent call last):
KeyError
disable_switchport(inter_type, inter)[source]

Change an interface’s operation to L3.

Parameters:
  • inter_type – The type of interface you want to configure. Ex. tengigabitethernet, gigabitethernet, fortygigabitethernet.
  • inter – The ID for the interface you want to configure. Ex. 1/0/1
Returns:

True if command completes successfully or False if not.

Raises:

None

enable_switchport(inter_type, inter)[source]

Change an interface’s operation to L2.

Parameters:
  • inter_type – The type of interface you want to configure. Ex. tengigabitethernet, gigabitethernet, fortygigabitethernet.
  • inter – The ID for the interface you want to configure. Ex. 1/0/1
Returns:

True if command completes successfully or False if not.

Raises:

None

fabric_isl(**kwargs)[source]

Set fabric ISL state.

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, etc)
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc)
  • enabled (bool) – Is fabric ISL state enabled? (True, False)
  • get (bool) – Get config instead of editing config. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, or state is not specified.
  • ValueError – if int_type, name, or state is not a valid value.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.fabric_isl(
...         int_type='tengigabitethernet',
...         name='225/0/40',
...         enabled=False)
...         dev.interface.fabric_isl()
...         
Traceback (most recent call last):
KeyError
fabric_neighbor(**kwargs)[source]

Set fabric neighbor discovery state. :param int_type: Type of interface. (gigabitethernet,

tengigabitethernet, etc)
Parameters:
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc)
  • enabled (bool) – Is fabric neighbor discovery enabled? (True, False)
  • get (bool) – Get config instead of editing config. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, or enabled is not specified.
  • ValueError – if int_type,`name`, or enabled is not a valid value

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.fabric_neighbor(
...         int_type='tengigabitethernet',
...         name='225/0/40')
...         output = dev.interface.fabric_neighbor(
...         int_type='tengigabitethernet',
...         name='225/0/40',
...         enabled=False)
...         output = dev.interface.fabric_neighbor(
...         get=True, int_type='tengigabitethernet',
...         name='225/0/40',
...         
Traceback (most recent call last):
KeyError
fabric_trunk(**kwargs)[source]

Set fabric trunk state.

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, etc)
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc)
  • enabled (bool) – Is Fabric trunk enabled? (True, False)
  • get (bool) – Get config instead of editing config. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, or state is not specified.
  • ValueError – if int_type, name, or state is not a valid value.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.fabric_trunk(name='225/0/40',
...         int_type='tengigabitethernet', enabled=False)
...         dev.interface.fabric_trunk()
...         
Traceback (most recent call last):
KeyError
static get_interface_detail_request(last_interface_name, last_interface_type)[source]

Creates a new Netconf request based on the last received interface name and type when the hasMore flag is true

static get_interface_switchport_request()[source]

Creates a new Netconf request

get_ip_addresses(**kwargs)[source]

Get IP Addresses already set on an Interface.

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet etc).
  • name (str) – Name of interface id. (For interface: 1/0/5, 1/0/10 etc).
  • version (int) – 4 or 6 to represent IPv4 or IPv6 address
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

List of 0 or more IPs configure on the specified interface.

Raises:
  • KeyError – if int_type or name is not passed.
  • ValueError – if int_type or name are invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...    conn = (switch, '22')
...    with pynos.device.Device(conn=conn, auth=auth) as dev:
...        int_type = 'tengigabitethernet'
...        name = '225/0/4'
...        ip_addr = '20.10.10.1/24'
...        version = 4
...        output = dev.interface.disable_switchport(inter_type=
...        int_type, inter=name)
...        output = dev.interface.ip_address(int_type=int_type,
...        name=name, ip_addr=ip_addr)
...        result = dev.interface.get_ip_addresses(
...        int_type=int_type, name=name, version=version)
...        assert len(result) >= 1
...        output = dev.interface.ip_address(int_type=int_type,
...        name=name, ip_addr=ip_addr, delete=True)
...        ip_addr = 'fc00:1:3:1ad3:0:0:23:a/64'
...        version = 6
...        output = dev.interface.ip_address(int_type=int_type,
...        name=name, ip_addr=ip_addr)
...        result = dev.interface.get_ip_addresses(
...        int_type=int_type, name=name, version=version)
...        assert len(result) >= 1
...        output = dev.interface.ip_address(int_type=int_type,
...        name=name, ip_addr=ip_addr, delete=True)
static get_node_value(node, node_name, urn)[source]
static get_port_chann_detail_request(last_aggregator_id)[source]

Creates a new Netconf request based on the last received aggregator id when the hasMore flag is true

static get_vlan_brief_request(last_vlan_id)[source]

Creates a new Netconf request based on the last received vlan id when the hasMore flag is true

int_ipv4_arp_aging_timout(**kwargs)[source]

Add “ip arp aging-time-out <>”.

Parameters:
  • int_type – L3 Interface type on which the ageout time needs to be configured.
  • name – L3 Interface name on which the ageout time needs to be configured.
  • arp_aging_timeout – Arp age out time in <0..240>.
  • enable (bool) – If ip arp aging time out needs to be enabled or disabled.Default:True.
  • get (bool) – Get config instead of editing config. (True, False)
  • rbridge_id (str) – rbridge-id for device. Only required when type is ‘ve’.
  • callback (function) –

    A function executed upon completion of the method. The only parameter passed to callback will be the

    ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, arp_aging_timeout is not passed.
  • ValueError – if int_type, name, arp_aging_timeout is invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.int_ipv4_arp_aging_timout(
...         int_type='tengigabitethernet',
...         name='225/0/38',
...         arp_aging_timeout='20',
...         rbridge_id='1')
...         output = dev.interface.int_ipv4_arp_aging_timout(
...         get=True,int_type='tengigabitethernet',
...         name='225/0/39',
...         arp_aging_timeout='40',
...         rbridge_id='9')
...         output = dev.interface.int_ipv4_arp_aging_timout(
...         enable=False,int_type='tengigabitethernet',
...         name='225/0/39',
...         arp_aging_timeout='40',
...         rbridge_id='9')
...         
Traceback (most recent call last):
KeyError
interface_detail

list[dict] – A list of dictionary items describing the interface type, name, role, mac, admin and operational state of interfaces of all rbridges. This method currently only lists the Physical Interfaces ( Gigabitethernet, tengigabitethernet, fortygigabitethernet, hundredgigabitethernet) and port-channel

interfaces

list[dict] – A list of dictionary items describing the operational state of interfaces. This method currently only lists the Physical Interfaces ( Gigabitethernet, tengigabitethernet, fortygigabitethernet, hundredgigabitethernet) and Loopback interfaces. It currently excludes VLAN interfaces, FCoE, Port-Channels, Management and Fibre Channel ports.

ip_address(**kwargs)[source]

Set IP Address on an Interface.

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet etc).
  • name (str) – Name of interface id. (For interface: 1/0/5, 1/0/10 etc).
  • ip_addr (str) – IPv4/IPv6 Virtual IP Address.. Ex: 10.10.10.1/24 or 2001:db8::/48
  • delete (bool) – True is the IP address is added and False if its to be deleted (True, False). Default value will be False if not specified.
  • rbridge_id (str) – rbridge-id for device. Only required when type is ve.
  • get (bool) – Get config instead of editing config. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, or ip_addr is not passed.
  • ValueError – if int_type, name, or ip_addr are invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...    conn = (switch, '22')
...    with pynos.device.Device(conn=conn, auth=auth) as dev:
...        int_type = 'tengigabitethernet'
...        name = '225/0/4'
...        ip_addr = '20.10.10.1/24'
...        output = dev.interface.disable_switchport(inter_type=
...        int_type, inter=name)
...        output = dev.interface.ip_address(int_type=int_type,
...        name=name, ip_addr=ip_addr)
...        output = dev.interface.ip_address(int_type=int_type,
...        name=name, ip_addr=ip_addr, delete=True)
...        output = dev.interface.add_vlan_int('86')
...        output = dev.interface.ip_address(int_type='ve',
...        name='86', ip_addr=ip_addr, rbridge_id='225')
...        output = dev.interface.ip_address(int_type='ve',
...        name='86', ip_addr=ip_addr, delete=True,
...        rbridge_id='225')
...        output = dev.interface.ip_address(int_type='loopback',
...        name='225', ip_addr='10.225.225.225/32',
...        rbridge_id='225')
...        output = dev.interface.ip_address(int_type='loopback',
...        name='225', ip_addr='10.225.225.225/32', delete=True,
...        rbridge_id='225')
...        ip_addr = 'fc00:1:3:1ad3:0:0:23:a/64'
...        output = dev.interface.ip_address(int_type=int_type,
...        name=name, ip_addr=ip_addr)
...        output = dev.interface.ip_address(int_type=int_type,
...        name=name, ip_addr=ip_addr, delete=True)
...        output = dev.interface.ip_address(int_type='ve',
...        name='86', ip_addr=ip_addr, rbridge_id='225')
...        output = dev.interface.ip_address(int_type='ve',
...        name='86', ip_addr=ip_addr, delete=True,
...        rbridge_id='225')
ip_mtu(**kwargs)[source]

Set interface mtu.

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, etc)
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc)
  • mtu (str) – Value between 1300 and 9018
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, or mtu is not specified.
  • ValueError – if int_type, name, or mtu is invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.ip_mtu(mtu='1666',
...         int_type='tengigabitethernet', name='225/0/38')
...         dev.interface.ip_mtu() # doctest:
+IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
KeyError

Configure ipv6 link local address on interfaces on vdx switches

Parameters:
  • int_type – Interface type on which the ipv6 link local needs to be configured.
  • name – ‘Ve’ or ‘loopback’ interface name.
  • rbridge_id (str) – rbridge-id for device.
  • get (bool) – Get config instead of editing config. (True, False)
  • delete (bool) – True, delete the mac-learning. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name is not passed.
  • ValueError – if int_type, name is invalid.

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.interface.ipv6_link_local(name='500',
...     int_type='ve',rbridge_id='1')
...     output = dev.interface.ipv6_link_local(get=True,name='500',
...     int_type='ve',rbridge_id='1')
...     output = dev.interface.ipv6_link_local(delete=True,
...     name='500', int_type='ve', rbridge_id='1')
lacp_timeout(**kwargs)[source]

Set lacp timeout.

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, etc)
  • timeout (str) – Timeout length. (short, long)
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, or timeout is not specified.
  • ValueError – if int_type, name, or `timeout is not valid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> int_type = 'tengigabitethernet'
>>> name = '225/0/39'
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.channel_group(name=name,
...         int_type=int_type, port_int='1',
...         channel_type='standard', mode='active')
...         output = dev.interface.lacp_timeout(name=name,
...         int_type=int_type, timeout='long')
...         dev.interface.lacp_timeout()
...         
Traceback (most recent call last):
KeyError
mtu(**kwargs)[source]

Set interface mtu.

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, etc)
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc)
  • mtu (str) – Value between 1522 and 9216
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, or mtu is not specified.
  • ValueError – if int_type, name, or mtu is invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.mtu(mtu='1666',
...         int_type='tengigabitethernet', name='225/0/38')
...         dev.interface.mtu() 
Traceback (most recent call last):
KeyError
overlay_gateway_activate(**kwargs)[source]

Activates the Overlay Gateway Instance on VDX switches

Parameters:
  • gw_name – Name of Overlay Gateway
  • get (bool) – Get config instead of editing config. (True, False)
  • delete (bool) – True, delete the activate config. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if gw_name is not passed.
  • ValueError – if gw_name is invalid.

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.interface.overlay_gateway_activate(
...     gw_name='Leaf')
...     output = dev.interface.overlay_gateway_activate(
...     get=True)
...     output = dev.interface.overlay_gateway_activate(
...     gw_name='Leaf', delete=True)
overlay_gateway_attach_rbridge_id(**kwargs)[source]

Configure Overlay Gateway attach rbridge id

Parameters:
  • gw_name – Name of Overlay Gateway <WORD:1-32>
  • rbridge_id – Single or range of rbridge id to be added/removed
  • get (bool) – Get config instead of editing config. (True, False)
  • delete (bool) – True, delete the attached rbridge list (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if gw_name, ‘rbridge_id’ is not passed.
  • ValueError – if gw_name, ‘rbridge_id’ is invalid.

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.interface.overlay_gateway_attach_rbridge_id(
...     gw_name='Leaf', rbridge_id='10')
...     output = dev.interface.overlay_gateway_attach_rbridge_id(
...     get=True)
...     output = dev.interface.overlay_gateway_attach_rbridge_id(
...     gw_name='Leaf', rbridge_id='1-2', delete=True)
overlay_gateway_loopback_id(**kwargs)[source]

Configure Overlay Gateway ip interface loopback

Parameters:
  • gw_name – Name of Overlay Gateway <WORD:1-32>
  • loopback_id – Loopback interface Id <NUMBER: 1-255>
  • get (bool) – Get config instead of editing config. (True, False)
  • delete (bool) – True, delete the overlay gateway loop back id. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if gw_name, ‘loopback_id’ is not passed.
  • ValueError – if gw_name, ‘loopback_id’ is invalid.

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.interface.overlay_gateway_loopback_id(
...     gw_name='Leaf', loopback_id='10')
...     output = dev.interface.overlay_gateway_loopback_id(
...     get=True)
...     output = dev.interface.overlay_gateway_loopback_id(
...     gw_name='Leaf', loopback_id='10', delete=True)
overlay_gateway_name(**kwargs)[source]

Configure Name of Overlay Gateway on vdx switches

Parameters:
  • gw_name – Name of Overlay Gateway
  • get (bool) – Get config instead of editing config. (True, False)
  • delete (bool) – True, delete the overlay gateway config. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if gw_name is not passed.
  • ValueError – if gw_name is invalid.

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.interface.overlay_gateway_name(gw_name='Leaf')
...     output = dev.interface.overlay_gateway_name(get=True)
...     output = dev.interface.overlay_gateway_name(gw_name='Leaf',
...              delete=True)
overlay_gateway_type(**kwargs)[source]

Configure Overlay Gateway Type on vdx switches

Parameters:
  • gw_name – Name of Overlay Gateway
  • gw_type – Type of Overlay Gateway(hardware-vtep/ layer2-extension/nsx)
  • get (bool) – Get config instead of editing config. (True, False)
  • delete (bool) – True, delete the overlay gateway type. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if gw_name, ‘gw_type’ is not passed.
  • ValueError – if gw_name, ‘gw_type’ is invalid.

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.interface.overlay_gateway_type(gw_name='Leaf',
...              gw_type='layer2-extension')
...     output = dev.interface.overlay_gateway_name(get=True)
overlay_gateway_vlan_vni_auto(**kwargs)[source]

Configure Overlay Gateway Vlan VNI mapping auto on VDX switches

Parameters:
  • gw_name – Name of Overlay Gateway
  • get (bool) – Get config instead of editing config. (True, False)
  • delete (bool) – True, delete vlan to vni auto mapping. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if gw_name is not passed.
  • ValueError – if gw_name is invalid.

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.interface.overlay_gateway_vlan_vni_auto(
...     gw_name='Leaf')
...     output = dev.interface.overlay_gateway_vlan_vni_auto(
...     get=True)
...     output = dev.interface.overlay_gateway_vlan_vni_auto(
...     gw_name='Leaf', delete=True)

Set minimum number of links in a port channel.

Parameters:
  • name (str) – Port-channel number. (1, 5, etc)
  • minimum_links (str) – Minimum number of links in channel group.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if name or minimum_links is not specified.
  • ValueError – if name is not a valid value.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.port_channel_minimum_links(
...         name='1', minimum_links='2')
...         dev.interface.port_channel_minimum_links()
...         
Traceback (most recent call last):
KeyError
port_channel_vlag_ignore_split(**kwargs)[source]

Ignore VLAG Split.

Parameters:
  • name (str) – Port-channel number. (1, 5, etc)
  • enabled (bool) – Is ignore split enabled? (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if name or enable is not specified.
  • ValueError – if name is not a valid value.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.port_channel_vlag_ignore_split(
...         name='1', enabled=True)
...         dev.interface.port_channel_vlag_ignore_split()
...         
Traceback (most recent call last):
KeyError
port_channels

list[dict] – A list of dictionary items of port channels.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.202']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.channel_group(name='226/0/1',
...         int_type='tengigabitethernet',
...         port_int='1', channel_type='standard', mode='active')
...         result = dev.interface.port_channels
...         is_port_channel_exist = False
...         for port_chann in result:
...             if port_chann['interface-name']=='port-channel-1':
...                 for interfaces in port_chann['interfaces']:
...                     for keys, values in interfaces.items():
...                         if '226/0/1' in values:
...                             is_port_channel_exist = True
...                             break
...         output = dev.interface.remove_port_channel(
...         port_int='1')
...         assert is_port_channel_exist
private_vlan_mode(**kwargs)[source]

Set PVLAN mode (promiscuous, host, trunk).

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, etc)
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc)
  • mode (str) – The switchport PVLAN mode.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, or mode is not specified.
  • ValueError – if int_type, name, or mode is invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> int_type = 'tengigabitethernet'
>>> name = '225/0/38'
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.enable_switchport(int_type,
...         name)
...         output = dev.interface.private_vlan_mode(
...         int_type=int_type, name=name, mode='trunk_host')
...         dev.interface.private_vlan_mode()
...         
Traceback (most recent call last):
KeyError
private_vlan_type(**kwargs)[source]

Set the PVLAN type (primary, isolated, community).

Parameters:
  • name (str) – VLAN ID.
  • pvlan_type (str) – PVLAN type (primary, isolated, community)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if name or pvlan_type is not specified.
  • ValueError – if name or pvlan_type is invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> name = '90'
>>> pvlan_type = 'isolated'
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.private_vlan_type(name=name,
...         pvlan_type=pvlan_type)
...         dev.interface.private_vlan_type()
...         
Traceback (most recent call last):
KeyError
proxy_arp(**kwargs)[source]

Set interface administrative state.

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, etc).
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc).
  • enabled (bool) – Is proxy-arp enabled? (True, False)
  • rbridge_id (str) – rbridge-id for device. Only required when type is ve.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, or state is not passed.
  • ValueError – if int_type, name, or state is invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         dev.interface.proxy_arp(int_type='tengigabitethernet',
...         name='225/0/12', enabled=True)
...         dev.interface.proxy_arp(int_type='tengigabitethernet',
...         name='225/0/12', enabled=False)
...         output = dev.interface.add_vlan_int('86')
...         output = dev.interface.ip_address(int_type='ve',
...         name='86', ip_addr='172.16.2.1/24', rbridge_id='225')
...         output = dev.interface.proxy_arp(int_type='ve',
...         name='86', enabled=True, rbridge_id='225')
...         output = dev.interface.proxy_arp(int_type='ve',
...         name='86', enabled=False, rbridge_id='225')
pvlan_host_association(**kwargs)[source]

Set interface PVLAN association.

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, etc)
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc)
  • pri_vlan (str) – The primary PVLAN.
  • sec_vlan (str) – The secondary PVLAN.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, pri_vlan, or sec_vlan is not specified.
  • ValueError – if int_type, name, pri_vlan, or sec_vlan is invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> int_type = 'tengigabitethernet'
>>> name = '225/0/38'
>>> pri_vlan = '75'
>>> sec_vlan = '100'
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.private_vlan_type(name=pri_vlan,
...         pvlan_type='primary')
...         output = dev.interface.private_vlan_type(name=sec_vlan,
...         pvlan_type='isolated')
...         output = dev.interface.vlan_pvlan_association_add(
...         name=pri_vlan, sec_vlan=sec_vlan)
...         output = dev.interface.enable_switchport(int_type,
...         name)
...         output = dev.interface.private_vlan_mode(
...         int_type=int_type, name=name, mode='host')
...         output = dev.interface.pvlan_host_association(
...         int_type=int_type, name=name, pri_vlan=pri_vlan,
...         sec_vlan=sec_vlan)
...         dev.interface.pvlan_host_association()
...         
Traceback (most recent call last):
KeyError
pvlan_trunk_association(**kwargs)[source]

Set switchport private vlan host association.

Args:

Returns:

Raises:

Examples:

remove_port_channel(**kwargs)[source]

Remove a port channel interface.

Parameters:
  • port_int (str) – port-channel number (1, 2, 3, etc).
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if port_int is not passed.
  • ValueError – if port_int is invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.channel_group(name='225/0/20',
...         int_type='tengigabitethernet',
...         port_int='1', channel_type='standard', mode='active')
...         output = dev.interface.remove_port_channel(
...         port_int='1')
set_ip(inter_type, inter, ip_addr)[source]

Set IP address of a L3 interface.

Parameters:
  • inter_type – The type of interface you want to configure. Ex. tengigabitethernet, gigabitethernet, fortygigabitethernet.
  • inter – The ID for the interface you want to configure. Ex. 1/0/1
  • ip_addr – IP Address in <prefix>/<bits> format. Ex: 10.10.10.1/24
Returns:

True if command completes successfully or False if not.

Raises:

None

spanning_tree_state(**kwargs)[source]

Set Spanning Tree state.

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, vlan, port_channel etc).
  • name (str) – Name of interface or VLAN id. (For interface: 1/0/5, 1/0/10 etc). (For VLANs 0, 1, 100 etc). (For Port Channels 1, 100 etc).
  • enabled (bool) – Is Spanning Tree enabled? (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, or enabled is not passed.
  • ValueError – if int_type, name, or enabled are invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         enabled = True
...         int_type = 'tengigabitethernet'
...         name = '225/0/37'
...         output = dev.interface.enable_switchport(int_type,
...         name)
...         output = dev.interface.spanning_tree_state(
...         int_type=int_type, name=name, enabled=enabled)
...         enabled = False
...         output = dev.interface.spanning_tree_state(
...         int_type=int_type, name=name, enabled=enabled)
...         int_type = 'vlan'
...         name = '102'
...         enabled = False
...         output = dev.interface.add_vlan_int(name)
...         output = dev.interface.enable_switchport(
...             int_type, name)
...         output = dev.interface.spanning_tree_state(
...         int_type=int_type, name=name, enabled=enabled)
...         enabled = False
...         output = dev.interface.spanning_tree_state(
...         int_type=int_type, name=name, enabled=enabled)
...         output = dev.interface.del_vlan_int(name)
...         int_type = 'port_channel'
...         name = '2'
...         enabled = False
...         output = dev.interface.channel_group(name='225/0/20',
...                              int_type='tengigabitethernet',
...                              port_int=name,
...                              channel_type='standard',
...                              mode='active')
...         output = dev.interface.enable_switchport(
...             int_type, name)
...         output = dev.interface.spanning_tree_state(
...         int_type=int_type, name=name, enabled=enabled)
...         enabled = False
...         output = dev.interface.spanning_tree_state(
...         int_type=int_type, name=name, enabled=enabled)
...         output = dev.interface.remove_port_channel(
...             port_int=name)
switchport(**kwargs)[source]

Set interface switchport status.

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, etc)
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc)
  • enabled (bool) – Is the interface enabled? (True, False)
  • get (bool) – Get config instead of editing config. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type or name is not specified.
  • ValueError – if name or int_type is not a valid value.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.switchport(name='225/0/19',
...         int_type='tengigabitethernet')
...         output = dev.interface.switchport(name='225/0/19',
...         int_type='tengigabitethernet', enabled=False)
...         dev.interface.switchport()
...         
Traceback (most recent call last):
KeyError
switchport_list

list[dict] – A list of dictionary items describing the details of list of dictionary items describing the details of switch port

switchport_pvlan_mapping(**kwargs)[source]

Switchport private VLAN mapping.

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, etc)
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc)
  • pri_vlan (str) – The primary PVLAN.
  • sec_vlan (str) – The secondary PVLAN.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, or mode is not specified.
  • ValueError – if int_type, name, or mode is invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> int_type = 'tengigabitethernet'
>>> name = '225/0/37'
>>> pri_vlan = '3000'
>>> sec_vlan = ['3001', '3002']
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.private_vlan_type(name=pri_vlan,
...         pvlan_type='primary')
...         output = dev.interface.enable_switchport(int_type,
...         name)
...         output = dev.interface.private_vlan_mode(
...         int_type=int_type, name=name, mode='trunk_promiscuous')
...         for spvlan in sec_vlan:
...             output = dev.interface.private_vlan_type(
...             name=spvlan, pvlan_type='isolated')
...             output = dev.interface.vlan_pvlan_association_add(
...             name=pri_vlan, sec_vlan=spvlan)
...             output = dev.interface.switchport_pvlan_mapping(
...             int_type=int_type, name=name, pri_vlan=pri_vlan,
...             sec_vlan=spvlan)
...         dev.interface.switchport_pvlan_mapping()
...         
Traceback (most recent call last):
KeyError
tag_native_vlan(**kwargs)[source]

Set tagging of native VLAN on trunk.

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, etc)
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc)
  • mode (str) – Trunk port mode (trunk, trunk-no-default-native).
  • enabled (bool) – Is tagging of the VLAN enabled on trunks? (True, False)
  • callback (function) – A function executed upon completion oj the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, or state is not specified.
  • ValueError – if int_type, name, or state is not valid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.trunk_mode(
...         int_type='tengigabitethernet',
...         name='225/0/38', mode='trunk')
...         output = dev.interface.tag_native_vlan(name='225/0/38',
...         int_type='tengigabitethernet')
...         output = dev.interface.tag_native_vlan(
...         int_type='tengigabitethernet',
...         name='225/0/38', enabled=False)
...         dev.interface.tag_native_vlan()
...         
Traceback (most recent call last):
KeyError
transport_service(**kwargs)[source]

Configure VLAN Transport Service.

Parameters:
  • vlan (str) – The VLAN ID.
  • service_id (str) – The transport-service ID.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if vlan or service_id is not specified.
  • ValueError – if vlan is invalid.

Examples

>>> # Skip due to current work in devel
>>> # TODO: Reenable
>>> def test_transport_service():
...     import pynos.device
...     switches = ['10.24.39.212', '10.24.39.202']
...     auth = ('admin', 'password')
...     vlan = '6666'
...     service_id = '1'
...     for switch in switches:
...         conn = (switch, '22')
...         with pynos.device.Device(conn=conn, auth=auth) as dev:
...             output = dev.interface.add_vlan_int(vlan)
...             output = dev.interface.spanning_tree_state(
...             int_type='vlan', name=vlan, enabled=False)
...             output = dev.interface.transport_service(vlan=vlan,
...             service_id=service_id)
...             dev.interface.transport_service()
...             
>>> test_transport_service() 
trunk_allowed_vlan(**kwargs)[source]

Modify allowed VLANs on Trunk (add, remove, none, all).

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, etc)
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc)
  • action (str) – Action to take on trunk. (add, remove, none, all)
  • get (bool) – Get config instead of editing config. (True, False)
  • vlan (str) – vlan id for action. Only valid for add and remove.
  • ctag (str) – ctag range. Only valid for add and remove.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, or mode is not specified.
  • ValueError – if int_type, name, or mode is invalid.

Examples

>>> # Skip due to current dev work
>>> # TODO: Reenable after dev work
>>> def test_trunk_allowed_vlan():
...     import pynos.device
...     switches = ['10.24.39.212', '10.24.39.202']
...     auth = ('admin', 'password')
...     int_type = 'tengigabitethernet'
...     name = '226/0/4'
...     for switch in switches:
...         conn = (switch, '22')
...         with pynos.device.Device(conn=conn, auth=auth) as dev:
...             output = dev.interface.enable_switchport(int_type,
...             name)
...             output = dev.interface.trunk_mode(name=name,
...             int_type=int_type, mode='trunk')
...             output = dev.interface.add_vlan_int('25')
...             output = dev.interface.add_vlan_int('8000')
...             output = dev.interface.trunk_allowed_vlan(
...             int_type=int_type, name=name, action='add',
...             ctag='25', vlan='8000')
...             dev.interface.private_vlan_mode()
...             
>>> test_trunk_allowed_vlan() 
trunk_mode(**kwargs)[source]

Set trunk mode (trunk, trunk-no-default-vlan).

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, etc)
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc)
  • mode (str) – Trunk port mode (trunk, trunk-no-default-native).
  • callback (function) – A function executed upon completion oj the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, or mode is not specified.
  • ValueError – if int_type, name, or mode is not valid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.trunk_mode(name='225/0/38',
...         int_type='tengigabitethernet', mode='trunk')
...         dev.interface.trunk_mode()
...         
Traceback (most recent call last):
KeyError
v6_nd_suppress_ra(**kwargs)[source]

Disable IPv6 Router Advertisements

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, etc)
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc)
  • rbridge_id (str) – rbridge-id for device. Only required when type is ve.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, or rbridge_id is not specified.
  • ValueError – if int_type, name, or rbridge_id is not a valid value.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.add_vlan_int('10')
...         output = dev.interface.v6_nd_suppress_ra(name='10',
...         int_type='ve', rbridge_id='225')
...         dev.interface.v6_nd_suppress_ra()
...         
Traceback (most recent call last):
KeyError
ve_interfaces(**kwargs)[source]

list[dict]: A list of dictionary items describing the operational state of ve interfaces along with the ip address associations.

Parameters:
  • rbridge_id (str) – rbridge-id for device.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:

None

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.interface.ve_interfaces()
...     output = dev.interface.ve_interfaces(rbridge_id='1')
vlan_pvlan_association_add(**kwargs)[source]

Add a secondary PVLAN to a primary PVLAN.

Parameters:
  • name (str) – VLAN number (1-4094).
  • sec_vlan (str) – The secondary PVLAN.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if name or sec_vlan is not specified.
  • ValueError – if name or sec_vlan is invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> int_type = 'tengigabitethernet'
>>> name = '20'
>>> sec_vlan = '30'
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.private_vlan_type(name=name,
...         pvlan_type='primary')
...         output = dev.interface.private_vlan_type(name=sec_vlan,
...         pvlan_type='isolated')
...         output = dev.interface.vlan_pvlan_association_add(
...         name=name, sec_vlan=sec_vlan)
...         dev.interface.vlan_pvlan_association_add()
...         
Traceback (most recent call last):
KeyError
vlans

list[dict] – A list of dictionary items describing the details of vlan interfaces. This method fetches the VLAN interfaces .. rubric:: Examples

>>> import pynos.device
>>> switch = '10.24.39.202'
>>> auth = ('admin', 'password')
>>> conn = (switch, '22')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.interface.add_vlan_int('736')
...     interfaces = dev.interface.vlans
...     is_vlan_interface_present = False
...     for interface in interfaces:
...         if interface['vlan-id'] == '736':
...             is_vlan_interface_present = True
...             break
...     dev.interface.del_vlan_int('736')
...     assert is_vlan_interface_present
True
vrrp_advertisement_interval(**kwargs)[source]

Set VRRP advertisement interval.

Args:

Returns:

Raises:

Examples:

vrrp_preempt(**kwargs)[source]

Set VRRP preempt mode (enabled, disabled).

Args:

Returns:

Raises:

Examples:

vrrp_priority(**kwargs)[source]

Set VRRP priority.

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, etc).
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc).
  • vrid (str) – VRRPv3 ID.
  • priority (str) – VRRP Priority.
  • ip_version (str) – Version of IP (4, 6).
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, vrid, priority, or ip_version is not passed.
  • ValueError – if int_type, name, vrid, priority, or ip_version is invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.anycast_mac(rbridge_id='225',
...         mac='aabb.ccdd.eeff', delete=True)
...         output = dev.services.vrrp(ip_version='6',
...         enabled=True, rbridge_id='225')
...         output = dev.services.vrrp(enabled=True,
...         rbridge_id='225')
...         output = dev.interface.set_ip('tengigabitethernet',
...         '225/0/18', '10.1.1.2/24')
...         output = dev.interface.ip_address(name='225/0/18',
...         int_type='tengigabitethernet',
...         ip_addr='2001:4818:f000:1ab:cafe:beef:1000:2/64')
...         dev.interface.vrrp_vip(int_type='tengigabitethernet',
...         name='225/0/18', vrid='1', vip='10.1.1.1/24')
...         dev.interface.vrrp_vip(int_type='tengigabitethernet',
...         name='225/0/18', vrid='1',
...         vip='fe80::cafe:beef:1000:1/64')
...         dev.interface.vrrp_vip(int_type='tengigabitethernet',
...         name='225/0/18', vrid='1',
...         vip='2001:4818:f000:1ab:cafe:beef:1000:1/64')
...         dev.interface.vrrp_priority(
...         int_type='tengigabitethernet',
...         name='225/0/18', vrid='1', ip_version='4',
...         priority='66')
...         dev.interface.vrrp_priority(
...         int_type='tengigabitethernet',
...         name='225/0/18', vrid='1', ip_version='6',
...         priority='77')
...         output = dev.interface.add_vlan_int('88')
...         output = dev.interface.ip_address(int_type='ve',
...         name='88', ip_addr='172.16.10.1/24', rbridge_id='225')
...         output = dev.interface.ip_address(int_type='ve',
...         name='88', rbridge_id='225',
...         ip_addr='2003:4818:f000:1ab:cafe:beef:1000:2/64')
...         dev.interface.vrrp_vip(int_type='ve', name='88',
...         vrid='1', vip='172.16.10.2/24', rbridge_id='225')
...         dev.interface.vrrp_vip(int_type='ve', name='88',
...         rbridge_id='225', vrid='1',
...         vip='fe80::dafe:beef:1000:1/64')
...         dev.interface.vrrp_vip(int_type='ve', rbridge_id='225',
...         name='88', vrid='1',
...         vip='2003:4818:f000:1ab:cafe:beef:1000:1/64')
...         dev.interface.vrrp_priority(int_type='ve', name='88',
...         rbridge_id='225', vrid='1', ip_version='4',
...         priority='66')
...         dev.interface.vrrp_priority(int_type='ve', name='88',
...         rbridge_id='225', vrid='1', ip_version='6',
...         priority='77')
...         output = dev.services.vrrp(ip_version='6',
...         enabled=False, rbridge_id='225')
...         output = dev.services.vrrp(enabled=False,
...         rbridge_id='225')
vrrp_state(**kwargs)[source]

Set VRRP state (enabled, disabled).

Args:

Returns:

Raises:

Examples:

vrrp_vip(**kwargs)[source]

Set VRRP VIP. :param int_type: Type of interface. (gigabitethernet,

tengigabitethernet, etc).
Parameters:
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc).
  • vrid (str) – VRRPv3 ID.
  • vip (str) – IPv4/IPv6 Virtual IP Address.
  • rbridge_id (str) – rbridge-id for device. Only required when type is ve.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, vrid, or vip is not passed.
  • ValueError – if int_type, name, vrid, or vip is invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.interface.anycast_mac(rbridge_id='225',
...         mac='aabb.ccdd.eeff', delete=True)
...         output = dev.services.vrrp(ip_version='6',
...         enabled=True, rbridge_id='225')
...         output = dev.services.vrrp(enabled=True,
...         rbridge_id='225')
...         output = dev.interface.set_ip('tengigabitethernet',
...         '225/0/18', '10.1.1.2/24')
...         output = dev.interface.ip_address(name='225/0/18',
...         int_type='tengigabitethernet',
...         ip_addr='2001:4818:f000:1ab:cafe:beef:1000:2/64')
...         dev.interface.vrrp_vip(int_type='tengigabitethernet',
...         name='225/0/18', vrid='1', vip='10.1.1.1/24')
...         dev.interface.vrrp_vip(int_type='tengigabitethernet',
...         name='225/0/18', vrid='1',
...         vip='fe80::cafe:beef:1000:1/64')
...         dev.interface.vrrp_vip(int_type='tengigabitethernet',
...         name='225/0/18', vrid='1',
...         vip='2001:4818:f000:1ab:cafe:beef:1000:1/64')
...         output = dev.interface.add_vlan_int('89')
...         output = dev.interface.ip_address(name='89',
...         int_type='ve', ip_addr='172.16.1.1/24',
...         rbridge_id='225')
...         output = dev.interface.ip_address(name='89',
...         int_type='ve', rbridge_id='225',
...         ip_addr='2002:4818:f000:1ab:cafe:beef:1000:2/64')
...         dev.interface.vrrp_vip(int_type='ve', name='89',
...         vrid='1', vip='172.16.1.2/24', rbridge_id='225')
...         dev.interface.vrrp_vip(int_type='ve', name='89',
...         vrid='1', vip='fe80::dafe:beef:1000:1/64',
...         rbridge_id='225')
...         dev.interface.vrrp_vip(int_type='ve', name='89',
...         vrid='1', vip='2002:4818:f000:1ab:cafe:beef:1000:1/64',
...         rbridge_id='225')
...         output = dev.services.vrrp(ip_version='6',
...         enabled=False, rbridge_id='225')
...         output = dev.services.vrrp(enabled=False,
...         rbridge_id='225')
vrrpe_spf_basic(**kwargs)[source]

Set vrrpe short path forwarding to default.

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, etc).
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc).
  • enable (bool) – If vrrpe short path fowarding should be enabled or disabled.Default:True.
  • get (bool) – Get config instead of editing config. (True, False)
  • vrid (str) – vrrpe router ID.
  • rbridge_id (str) – rbridge-id for device. Only required when type is ve.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, vrid is not passed.
  • ValueError – if int_type, name, vrid is invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.services.vrrpe(ip_version='6',
...         enable=True, rbridge_id='225')
...         output = dev.interface.vrrpe_vip(int_type='ve',
...         name='89', vrid='1',
...         vip='2002:4818:f000:1ab:cafe:beef:1000:1/64',
...         output = dev.interface.vrrpe_vip(int_type='ve',
...         name='89',
...         vrid='1', vip='2002:4818:f000:1ab:cafe:beef:1000:1/64',
...         rbridge_id='225')
...         output = dev.services.vrrpe(enable=False,
...         rbridge_id='225')
...         output = dev.interface.vrrpe_spf_basic(int_type='ve',
...         name='89', vrid='1', rbridge_id='1')
vrrpe_vip(**kwargs)[source]

Set vrrpe VIP.

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, ve, etc).
  • name (str) – Name of interface. (1/0/5, 1/0/10, VE name etc).
  • vrid (str) – vrrpev3 ID.
  • get (bool) – Get config instead of editing config. (True, False)
  • delete (bool) – True, the VIP address is added and False if its to be deleted (True, False). Default value will be False if not specified.
  • vip (str) – IPv4/IPv6 Virtual IP Address.
  • rbridge_id (str) – rbridge-id for device. Only required when type is ve.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Raises:
  • KeyError – if int_type, name, vrid, or vip is not passed.
  • ValueError – if int_type, name, vrid, or vip is invalid.
Returns:

Return value of callback.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output =dev.interface.vrrpe_vip(int_type='ve',
...         name='89', rbridge_id = '1',
...         vrid='11', vip='10.0.1.10')
...         output = dev.interface.vrrpe_vip(get=True,
...         int_type='ve', name='89', rbridge_id = '1')
...         output =dev.interface.vrrpe_vip(delete=True,
...         int_type='ve', name='89', rbridge_id = '1',vrid='1',
...         vip='10.0.0.10')
vrrpe_vmac(**kwargs)[source]

Set vrrpe virtual mac.

Parameters:
  • int_type (str) – Type of interface. (gigabitethernet, tengigabitethernet, etc).
  • name (str) – Name of interface. (1/0/5, 1/0/10, etc).
  • vrid (str) – vrrpev3 ID.
  • enable (bool) – If vrrpe virtual MAC should be enabled or disabled.Default:True.
  • get (bool) – Get config instead of editing config. (True, False)
  • virtual_mac (str) – Virtual mac-address in the format
  • 02e0.5200.00xx.
  • rbridge_id (str) – rbridge-id for device. Only required
  • type is 've'. (when) –
  • callback (function) – A function executed upon completion
  • the method. The only parameter passed to callback (of) –
  • be the ElementTree config. (will) –
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, vrid, or vmac is not passed.
  • ValueError – if int_type, name, vrid, or vmac is invalid.
Returns:

Return value of callback.

Raises:
  • KeyError – if int_type, name, vrid, or vmac is not passed.
  • ValueError – if int_type, name, vrid, or vmac is invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.services.vrrpe(enable=False,
...         rbridge_id='225')
...         output = dev.interface.vrrpe_vip(int_type='ve',
...         name='89',vrid='1',
...         vip='2002:4818:f000:1ab:cafe:beef:1000:1/64',
...         rbridge_id='225')
...         output = dev.services.vrrpe(enable=False,
...         rbridge_id='225')
...         output = dev.interface.vrrpe_vmac(int_type='ve',
...         name='89', vrid='1', rbridge_id='1',
...         virtual_mac='aaaa.bbbb.cccc')

pynos.versions.base.lldp module

Copyright 2015 Brocade Communications Systems, Inc.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class pynos.versions.base.lldp.LLDP(callback)[source]

Bases: object

LLDP class containing LLDP methods and attributes.

static get_lldp_neighbors_request(last_ifindex, rbridge_id)[source]

Creates a new Netconf request based on the last received or if rbridge_id is specifed ifindex when the hasMore flag is true

neighbors(**kwargs)[source]

list[dict]: A list of dictionary items describing the operational state of LLDP.

pynos.versions.base.services module

Copyright 2015 Brocade Communications Systems, Inc.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class pynos.versions.base.services.Services(callback)[source]

Bases: object

The Services class holds all relevent methods and attributes for enabling and disabling NOS services, such as VRRP.

None
arp

dict – trill link details

vrrp(**kwargs)[source]

Enable or Disable VRRP.

Parameters:
  • ip_version (str) – The IP version (‘4’ or ‘6’) for which VRRP should be enabled/disabled. Default: 4.
  • enabled (bool) – If VRRP should be enabled or disabled. Default: True.
  • rbridge_id (str) – The rbridge ID of the device on which VRRP will be enabled/disabled. Default: 1.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:

None

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         output = dev.bgp.local_asn(rbridge_id='225')
...         output = dev.bgp.local_asn(rbridge_id='225',
...         enabled=False)
...         output = dev.bgp.local_asn(rbridge_id='225',
...         ip_version='6')
...         output = dev.bgp.local_asn(rbridge_id='225',
...         enabled=False, ip_version='6')
...         dev.services.vrrp() 
Traceback (most recent call last):
KeyError
vrrpe(**kwargs)[source]

Enable or Disable Vrrpe. :param ip_version: The IP version (‘4’ or ‘6’) for which vrrpe

should be enabled/disabled. Default: 4.
Parameters:
  • enable (bool) – If vrrpe should be enabled or disabled. Default: True.
  • get (bool) – Get config instead of editing config. (True, False)
  • rbridge_id (str) – The rbridge ID of the device on which vrrpe will be enabled/disabled. Default: 1.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:

None

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         dev.services.vrrpe(rbridge_id='25',enable=False)
...         dev.services.vrrpe(rbridge_id='25',enable=True)
...         dev.services.vrrpe()
Traceback (most recent call last):
KeyError

pynos.versions.base.snmp module

Copyright 2015 Brocade Communications Systems, Inc.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class pynos.versions.base.snmp.SNMP(callback)[source]

Bases: object

SNMP class containing all SNMP level methods and attributes.

add_snmp_community(**kwargs)[source]

Add SNMP Community to NOS device.

Parameters:
  • community (str) – Community string to be added to device.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:

KeyError – if community is not defined.

add_snmp_host(**kwargs)[source]

Add SNMP host to NOS device.

Parameters:
  • host_info (tuple(str, str) – Tuple of host IP and port.
  • community (str) – Community string to be added to device.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:

KeyError – if host_info or community is not defined.

del_snmp_community(**kwargs)[source]

Delete SNMP Community from NOS device.

Parameters:
  • community (str) – Community string to be added to device.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:

KeyError – if community is not defined.

del_snmp_host(**kwargs)[source]

Delete SNMP host from NOS device.

Parameters:
  • host_info (tuple(str, str) – Tuple of host IP and port.
  • community (str) – Community string to be added to device.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:

KeyError – if host_info or community is not defined.

pynos.versions.base.system module

Copyright 2015 Brocade Communications Systems, Inc.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class pynos.versions.base.system.System(callback)[source]

Bases: object

System class containing all system level methods and attributes.

chassis_name(**kwargs)[source]

Get device’s chassis name/Model.

Parameters:
  • rbridge_id (str) – The rbridge ID of the device
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:

KeyError – if rbridge_id is not specified.

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.system.chassis_name(rbridge_id='225')
...     assert output == 'VDX6740'
host_name(**kwargs)[source]

Configures device’s host name.

Parameters:
  • rbridge_id (str) – The rbridge ID of the device on which BGP will be configured in a VCS fabric.
  • host_name (str) – The host name of the device.
  • get (bool) – Get config instead of editing config. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:

KeyError – if rbridge_id is not specified.

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.system.host_name(rbridge_id='225',
...     host_name='sw0')
...     output = dev.system.host_name(rbridge_id='225', get=True)
...     try:
...         conf = output.data.find('.//{*}host-name').text
...     except AttributeError:
...         conf = None
...     assert conf == 'sw0'
rbridge_id(**kwargs)[source]

Configures device’s rbridge ID. Setting this property will need a switch reboot

Parameters:
  • rbridge_id (str) – The rbridge ID of the device on which BGP will be configured in a VCS fabric.
  • get (bool) – Get config instead of editing config. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:

KeyError – if rbridge_id is not specified.

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.system.rbridge_id(rbridge_id='225')
...     output = dev.system.rbridge_id(rbridge_id='225', get=True)
...     dev.system.rbridge_id() 
Traceback (most recent call last):
KeyError
router_id(**kwargs)[source]

Configures device’s Router ID.

Parameters:
  • router_id (str) – Router ID for the device.
  • rbridge_id (str) – The rbridge ID of the device on which BGP will be configured in a VCS fabric.
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:

KeyError – if router_id is not specified.

Examples

>>> import pynos.device
>>> conn = ('10.24.39.211', '22')
>>> auth = ('admin', 'password')
>>> with pynos.device.Device(conn=conn, auth=auth) as dev:
...     output = dev.system.router_id(router_id='10.24.39.211',
...     rbridge_id='225')
...     dev.system.router_id() 
Traceback (most recent call last):
KeyError
uptime

dict – device uptime

pynos.versions.base.vcs module

Copyright 2015 Brocade Communications Systems, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class pynos.versions.base.vcs.VCS(callback)[source]

Bases: object

VCS class containing all VCS methods and attributes.

vcs_nodes

dict – vcs node details

vcs_vip(**kwargs)[source]

Set VCS Virtual IP.

Parameters:
  • vip (str) – IPv4/IPv6 Virtual IP Address.
  • rbridge_id (str) – rbridge-id for device. Only required when type is ve.
  • delete (bool) – Deletes the virtual ip if delete is True.
  • get (bool) – Get config instead of editing config. (True, False)
  • callback (function) – A function executed upon completion of the method. The only parameter passed to callback will be the ElementTree config.
Returns:

Return value of callback.

Raises:
  • KeyError – if vip is not passed.
  • ValueError – if vip is invalid.

Examples

>>> import pynos.device
>>> switches = ['10.24.39.211', '10.24.39.203']
>>> auth = ('admin', 'password')
>>> for switch in switches:
...     conn = (switch, '22')
...     with pynos.device.Device(conn=conn, auth=auth) as dev:
...         dev.interface.vcs_vip(vip='10.1.1.1/24')
...         dev.interface.vcs_vip(vip='fe80::cafe:beef:1000:1/64')
...         dev.interface.vcs_vip(vip='10.1.1.1/24',get=True)
...         dev.interface.vcs_vip(vip='fe80::cafe:beef:1000:1/64',
...                               get=True)
...         dev.interface.vcs_vip(vip='fe80::cafe:beef:1000:1/64',
...                               delete=True)
...         dev.interface.vcs_vip(vip='10.1.1.1/24',get=True)
...         dev.interface.vcs_vip(vip='fe80::cafe:beef:1000:1/64',
...                               get=True)
...         dev.interface.vcs_vip(vip='10.1.1.1/24',delete=True)
...         dev.interface.vcs_vip(vip='fe80::cafe:beef:1000:1/64',
...                               delete=True)

Module contents

Copyright 2015 Brocade Communications Systems, Inc.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.