Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding features to create stacking ports and cleaning automation pack… #58

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 46 additions & 1 deletion lib/netconify/cmdo.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,22 @@ def _init_argsparser(self):
action='store_true',
help='Disable cluster mode on SRX device and reboot')

# ---------------------------------------------------------------------
g.add_argument('--stack_port1',
dest='request_stack_port1',
action='store_true',
help='Create virtual-chassis ports into qfx devices (Port 52)')

g.add_argument('--stack_port2',
dest='request_stack_port2',
action='store_true',
help='Create virtual-chassis ports into qfx devices (Port 53)')

g.add_argument('--clean_automation_packages',
dest='request_clean_automation_packages',
action='store_true',
help='Remove the ruby, jpuppet chef and ez-stdlib packages')

# ---------------------------------------------------------------------
# directories
# ---------------------------------------------------------------------

Expand Down Expand Up @@ -370,6 +385,18 @@ def _do_actions(self):
self._push_config()
if args.qfx_mode is not None:
self._qfx_mode()

if args.request_stack_port1:
self._stack_port1()
return

if args.request_stack_port2:
self._stack_port2()
return

if args.request_clean_automation_packages:
self._clean_automation_packages()
return

def _srx_cluster(self):
""" Enable cluster mode on SRX device"""
Expand Down Expand Up @@ -400,6 +427,24 @@ def _zeroize(self):
self._skip_logout = True
self.results['changed'] = True

def _stack_port1(self):
"""Create Virtual Chassis Ports """
self._notify('VC-port-52', 'DONE')
self._tty.nc.stack1()
self.results['changed'] = True

def _stack_port2(self):
"""Create Virtual Chassis Ports """
self._notify('VC-port-53', 'DONE')
self._tty.nc.stack2()
self.results['changed'] = True

def _clean_automation_packages(self):
"""Remove the ruby jpuppet chef and ez-stdlib packages """
self._notify('Remove-automation-packages', 'DONE')
self._tty.nc.cleanpackages()
self.results['changed'] = True

def _shutdown(self):
""" shutdown or reboot """
self._skip_logout = True
Expand Down
42 changes: 42 additions & 0 deletions lib/netconify/tty_netconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,48 @@ def zeroize(self):
pass
return True

def stack1(self):
""" create vc-ports on the device """
cmd = E.command('request virtual-chassis vc-port set pic-slot 0 port 52')
try:
rsp = self.rpc(etree.tostring(cmd))
except:
pass
return True

def stack2(self):
""" create vc-ports on the device """
cmd = E.command('request virtual-chassis vc-port set pic-slot 0 port 53')
try:
rsp = self.rpc(etree.tostring(cmd))
except:
pass
return True

def cleanpackages(self):
""" remove jpuppet ruby chef ez-stdlib packages """
cmd = E.command('request system software delete jpuppet')
try:
rsp = self.rpc(etree.tostring(cmd))
except:
pass
cmd = E.command('request system software delete ruby')
try:
rsp = self.rpc(etree.tostring(cmd))
except:
pass
cmd = E.command('request system software delete chef')
try:
rsp = self.rpc(etree.tostring(cmd))
except:
pass
cmd = E.command('request system software delete junos-ez-stdlib')
try:
rsp = self.rpc(etree.tostring(cmd))
except:
pass
return True

def enablecluster(self, cluster_id, node):
""" issue request chassis cluster command """
cmd = E('set-chassis-cluster-enable',
Expand Down