diff --git a/lib/netconify/cmdo.py b/lib/netconify/cmdo.py index d0e57d9..708955f 100644 --- a/lib/netconify/cmdo.py +++ b/lib/netconify/cmdo.py @@ -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 # --------------------------------------------------------------------- @@ -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""" @@ -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 diff --git a/lib/netconify/tty_netconf.py b/lib/netconify/tty_netconf.py index 27646b0..afa3502 100644 --- a/lib/netconify/tty_netconf.py +++ b/lib/netconify/tty_netconf.py @@ -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',