Simple Netscout script to create/delete port pairings and to report information about ports, connections etc.
Includes an extended telnetlib library that provides a telnet.log so commands can be tracked.
Can be used to connect or disconnect ports by name.
--help : show this help message and exit
--connect port1 port2 : Create a connection between two ports
--disconnect port [port ...] : Disconnect a port(s) from its connection
--listgroups : Lists all the configured groups
--listports : Lists all the ports on the netscout
--portinfo port : Prints port information
--showconnections : Lists all the connections on netscout
--downloadhelp : Downloads CLI command help for netscout in txt file
--resetconfig : Resets config file
/root/Python-3.4.3/python NSConnect.py --connect {port 1} {port2}
/root/Python-3.4.3/python NSConnect.py --disconnect {port1} {port2}
/root/Python-3.4.3/python NSConnect.py --listports
/root/Python-3.4.3/python NSConnect.py --showconnections
/root/Python-3.4.3/python NSConnect.py --downloadhelp
install_python34() {
pushd /root 1>/dev/null
wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgz > /dev/null 2>&1
tar zxvf Python-3.4.3.tgz > /dev/null 2>&1
pushd /root/Python-3.4.3
./configure > /dev/null 2>&1
make > /dev/null 2>&1
make install > /dev/null 2>&1
popd 1>/dev/null
}
python install scl-utils -y
cat <<'EOT' >> /etc/yum.repos.d/python34.repo
[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=http://mirror.centos.org/centos/7/sclo/$basearch/rh/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
EOT
yum -y install $(echo "
rh-python34
rh-python34-python-tkinter
" | grep -v ^#)
rm -f /etc/yum.repos.d/python34.repo
scl enable rh-python34 bash
$MYENV=<path to your desired virtual env> # /home/python3env works well for most cases
virtualenv "$MYENV"
yum install -y python-setuptools
easy_install pip
pip install selectors34
python install scl-utils -y
scl enable rh-python34 - << \EOF
source $MYENV/bin/activate
pip install selectors34
python NSConnect.py -h
EOF
If using python 3.3 the selectors package will cause a problem because it it not readily available. To resolve install the selectors34 package with pip.