System Class
Provides miscellaneous system configuration.
class System(object)
Example:
>>> import cisco
>>> from cisco.system import *
>>> sys = System()
set_banner
Sets the MOTD banner of the switch.
set_banner(self, banner=None)
Example:
>>> from cisco.system import *
>>> sys = System()
>>> sys.set_banner("Welcome to TSI-N9508-3")
True
Arguments:
- banner: A string
Returns: True on success
get_banner
Gets the MOTD banner of the switch.
get_banner(self)
Example:
>>> import cisco
>>> from cisco.system import *
>>> sys = System()
>>> sys.get_banner()
'Welcome to TSI-N9508-3'
Arguments: none
Returns: The MOTD banner of the switch
set_hostname
Sets the hostname of the switch.
set_hostname(self, name=None)
Example:
>>> from cisco.system import *
>>> sys = System()
>>> sys.set_hostname('TSI-N9508-3')
True
Arguments:
- name:
Returns: True on success
get_hostname
Gets the hostname of the switch.
get_hostname(self)
Example:
>>> from cisco.system import *
>>> sys = System()
>>> sys.get_hostname()
'TSI-N9508-3'
Arguments: none
Returns: Hostname of the switch
set_mgmt0_ip
Sets the IPv4 or IPv6 address and netmask on mgmt0.
set_mgmt0_ip(self, address=None, mask=None)
Example:
>>> from cisco.system import *
>>> sys = System()
>>> sys.set_mgmt0_ip('192.0.2.235/24')
True
Arguments:
- address and optional mask in the form:
- ip (for example, 192.0.2.1)
- ip/maskbits (for example, 192.0.2.1/24)
- ip/mask (for example, 192.0.2.1/255.255.255.0)
- mask: if not included in 'address' argument, specify number of mask bits or mask in CIDR form (A.B.C.D).
Returns: True on success
get_mgmt0_ip
Gets the IP address of the mgmt0 interface
get_mgmt0_ip(self)
Example:
>>> from cisco.system import *
>>> sys = System()
>>> sys.get_mgmt0_ip()
'192.0.2.235/24'
Arguments: none
Returns: IP address of the mgmt0 interface
set_password
Sets the user password and associated options.
set_password(self, username="admin", password=None, expire=None, role=None, delete=None)
Examples:
>>> from cisco.system import *
>>> sys = System()
>>> sys.set_password(password="cisco123")
True
>>> sys.set_password(username="guest", password="cisco123")
True
Arguments:
username: Name of the user. If not specified, assumed to be 'admin'
password: [0|5]WORD
- 0: Indicates that the password that follows should be in clear text
- 5: Indicates that the password that follows should be encrypted
- WORD: Password for the user (clear text) (Max Size 64)
expire: expiry in YYYY-MM-DD format (Max Size 10)
role: where role is one of the following:
- network-admin System configured role
- network-operator System configured role
- priv-0 Privilege role
- priv-1 Privilege role
- priv-10 Privilege role
- priv-11 Privilege role
- priv-12 Privilege role
- priv-13 Privilege role
- priv-14 Privilege role
- priv-15 Privilege role
- priv-2 Privilege role
- priv-3 Privilege role
- priv-4 Privilege role
- priv-5 Privilege role
- priv-6 Privilege role
- priv-7 Privilege role
- priv-8 Privilege role
- priv-9 Privilege role
- vdc-admin System configured role
- vdc-operator System configured role
delete: If True, delete the password for this user
Returns: True on success