VOSS Pack

Succeeded.JPG

Make directory called voss in /opt/stackstorm/packs…

mkdir voss

Change location to voss folder…

cd voss

Copy the following files to the folder: icon.png (Extreme Networks logo); pack.yaml; config.schema.yaml

Create sub-folder actions and copy the following files there: cmd.yaml; cmd.py (Python script)

Copy voss.yaml file to /opt/stackstorm/configs folder.

Note: Take care with indentation, whitespace characters and syntax when creating script and yaml files to avoid wasting time troubleshooting when installing packs.

Installing new voss pack…

git init && git add ./* && git commit -m “Initial commit”
st2 pack install file:///$PWD

Note: If something fails worth checking the file attributes allow access. Add permissions with sudo chmod 777 . -R.

Note: Can remove .git folder with sudo rm -r .git if need to rebuild by doing another git.

Execute Action (voss.cmd) which allows you to enter IP address of the switch and the command to use. For example, enter IP 192.168.1.2 (core switch 2) and pass command show autotop nmm will initiate SSH connection run the command and save the output to a file before closing the SSH session.

cat ‘Log file of 192.168.1.2’

Using security software from Mocana Corporation. Please visit https://www.mocana.com/ for more information

Copyright(c) 2010-2018 Extreme Networks.
All Rights Reserved.
VSP Simulator: Virtual Services Platform  8200
VSP Operating System Software Build 7.0.0.0_B885
Unsupported Software, Internal Use Only

This product is protected by one or more US patents listed at http://www.extremenetworks.com/patents along with their foreign counterparts.

EXTREME NETWORKS VOSS COMMAND LINE INTERFACE

core2:1>show autotop nmm
==========================================================================================
Topology Table
==========================================================================================
Local                                                                              Rem
Port     IpAddress       SegmentId MacAddress   ChassisType            BT LS  CS   Port
——————————————————————————————
0/0      192.168.1.2     0x000000  005100f92800 VSP8284XSQ             12 Yes HtBt  0/0
1/1      10.0.0.43       0x000101  005100eb2800 VSP8284XSQ             12 Yes HtBt  1/1
1/1      192.168.1.5     0x000107  703018a4e101 ERS3510GT              12 Yes HtBt  1/7
1/8      10.0.0.43       0x000108  005100eb2807 VSP8284XSQ             12 Yes HtBt  1/8

*******************************

Pack

pack.yaml


ref: voss
name: VOSS
description: Actions for managing Extreme Networks EXOS devices
keywords:
– voss
version: 0.0.2
author: Extreme Networks
email: support@extremenetworks.com

config.schema.yaml


username:
description: “Login username”
type: “string”
required: true
default: “rwa”
password:
description: “Login password”
type: “string”
required: true
default: “rwa”

Actions

cmd.yaml


name: “cmd”
runner_type: “python-script”
description: “run list of VOSS commands on a remote switch.”
enabled: true
entry_point: “cmd.py”
parameters:
ipaddress:
type: “string”
description: “IP address of the VOSS switch.”
required: true
position: 0
cmd:
type: “string”
description: “List of VOSS CLI commands.”
required: true
position: 1

cmd.py

from st2common.runners.base_action import Action
import paramiko

class VOSSCmd(Action):

def run(self, ipaddress=’192.168.1.1′, cmd=”):
“””
Run a VOSS command on the remote switch

Args:
– ipaddress: The IP address of the switch
– username: login user name
– password: login password
– cmd: either a single EXOS command or list of VOSS commands

Raises:
– ValueError: On switch reponse being invalid
– RuntimeError: if switch cannot process the command

Returns:
dict: with VOSS CLI results
“””

username=’rwa’
password=’rwa’

ssh_client = paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_client.connect(hostname=ipaddress,username=username,password=password)

print ‘Successful connection’, ipaddress

remote_connection = ssh_client.invoke_shell()

print ‘Collecting troubeshooting log file of ‘ + ipaddress

remote_connection.send(cmd)
remote_connection.send(‘\n’)

readoutput = remote_connection.recv(655350)

saveoutput = open(‘Log file of ‘ + ipaddress, ‘w’)

print ‘Saving to file called Log file of ‘ + ipaddress + ‘\n’

saveoutput.write(readoutput)
saveoutput.write(‘\n’)
saveoutput.close

ssh_client.close()

 

Configs

voss.yaml


username: “rwa”
password: “rwa”

Note: If pack or config files change rerun one of the following:

st2ctl reload –register-actions

st2ctl reload –register-configs

Note: Locate the output file with following command syntax…

find / -name ‘Log file of 192.168.1.1’ 2>/dev/null

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s