diff --git a/library/juniper/event/interfaces/disable-the-down-down-interfaces/disable-the-down-down-interfaces.conf b/library/juniper/event/interfaces/disable-the-down-down-interfaces/disable-the-down-down-interfaces.conf new file mode 100644 index 0000000..2ef64c7 --- /dev/null +++ b/library/juniper/event/interfaces/disable-the-down-down-interfaces/disable-the-down-down-interfaces.conf @@ -0,0 +1,14 @@ +event-options { + generate-event { + weekly time-interval 604800 no-drift; + } + inactive: policy weekly-disable-interfaces { + events weekly; + then { + event-script disable-the-down-down-interfaces.slax; + } + } + event-script { + file disable-the-down-down-interfaces.slax; + } +} diff --git a/library/juniper/event/interfaces/disable-the-down-down-interfaces/disable-the-down-down-interfaces.slax b/library/juniper/event/interfaces/disable-the-down-down-interfaces/disable-the-down-down-interfaces.slax new file mode 100644 index 0000000..def586c --- /dev/null +++ b/library/juniper/event/interfaces/disable-the-down-down-interfaces/disable-the-down-down-interfaces.slax @@ -0,0 +1,48 @@ +/* +* Disables interfaces that are showing a down/down status +*/ + +version 1.0; +ns junos = "http://xml.juniper.net/junos/*/junos"; +ns xnm = "http://xml.juniper.net/xnm/1.1/xnm"; +ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0"; + +import "../import/junos.xsl"; + +match / { + + /* Open connection with mgd and show interfaces terse */ + var $rpc = { + { + ; + } + } + var $con = jcs:open(); + var $int = jcs:execute($con, $rpc); + + /* Only down down interfaces */ + var $down-interfaces = $int/physical-interface[admin-status == 'down' && oper-status == 'down']; + + /* Disable configuration for only the down/down interfaces */ + var $xml := { + { + for-each ( $down-interfaces ) { + { + { + name; + ; + } + } + } + } + } + + /* Use load then commit the configuration */ + var $results := { + call jcs:load-configuration($connection = $con, $configuration = $xml); + } + + /* Close the mgd connection */ + expr jcs:close($con); + +} \ No newline at end of file diff --git a/library/juniper/event/interfaces/disable-the-down-down-interfaces/disable-the-down-down-interfaces.xml b/library/juniper/event/interfaces/disable-the-down-down-interfaces/disable-the-down-down-interfaces.xml new file mode 100644 index 0000000..9011fa4 --- /dev/null +++ b/library/juniper/event/interfaces/disable-the-down-down-interfaces/disable-the-down-down-interfaces.xml @@ -0,0 +1,22 @@ + + diff --git a/library/juniper/op/display/show-interface-status-2/show-interface-status-2.xml b/library/juniper/op/display/show-interface-status-2/show-interface-status-2.xml new file mode 100644 index 0000000..76dec92 --- /dev/null +++ b/library/juniper/op/display/show-interface-status-2/show-interface-status-2.xml @@ -0,0 +1,18 @@ + + diff --git a/library/juniper/op/display/show-interface-status-2/show-interfaces-status-2.slax b/library/juniper/op/display/show-interface-status-2/show-interfaces-status-2.slax new file mode 100644 index 0000000..8ab4ed4 --- /dev/null +++ b/library/juniper/op/display/show-interface-status-2/show-interfaces-status-2.slax @@ -0,0 +1,45 @@ +version 1.2; + +ns junos = "http://xml.juniper.net/junos/*/junos"; +ns xnm = "http://xml.juniper.net/xnm/1.1/xnm"; +ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0"; + +import "../import/junos.xsl"; + +match / { + { + + /* show interfaces extensive to capture description, status, duplex, and speed */ + var $rpc1 = { + { + ; + } + } + var $int = jcs:invoke( $rpc1 ); + + /* show ethernet-switching interfaces to capture port, vlan id, and tagging */ + var $rpc2 = { + { + ; + } + } + var $eth = jcs:invoke( $rpc2 ); + + /* print the header */ + jcs:printf( "%-20s%-27s%-11s%-12s%-20s%-16s%-18s", "Port", "Description", "Status", "VLAN ID", "Tagging", "Duplex", "Speed"); + + /* for loop with the vlan ids, ignore the empty ones */ + for-each ( $eth/l2ng-l2ald-iff-interface-entry[string-length(l2iff-interface-vlan-id) > 0] ) { + + /* grabbing the name of the physical interface ignoring the .0 */ + var $etname = substring-before(l2iff-interface-name,"."); + + /* confirmation of Admin and Link status, only print when both are up */ + if (($int/physical-interface[name==$etname]/admin-status=="up") && ($int/physical-interface[name==$etname]/oper-status=="down")) { + + /* print each line */ + jcs:printf( "%-20s%-27s%-11s%-12s%-20s%-16s%-18s", l2iff-interface-name, $int/physical-interface[name==$etname]/link-level-type, $int/physical-interface[name==$etname]/oper-status, l2iff-interface-vlan-id, l2iff-interface-vlan-member-tagness, $int/physical-interface[name==$etname]/link-type, $int/physical-interface[name==$etname]/speed); + } + } + } +} diff --git a/library/juniper/op/display/storm-control/storm-control.slax b/library/juniper/op/display/storm-control/storm-control.slax new file mode 100644 index 0000000..8894fb4 --- /dev/null +++ b/library/juniper/op/display/storm-control/storm-control.slax @@ -0,0 +1,31 @@ +version 1.0; + +ns junos = "http://xml.juniper.net/junos/*/junos"; +ns xnm = "http://xml.juniper.net/xnm/1.1/xnm"; +ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0"; + +import "../import/junos.xsl"; + +match / { + { + + /* show interfaces extensive to capture unicast, broadcast, and multicast traffic */ + var $rpc = { + { + ; + } + } + var $int = jcs:invoke( $rpc ); + + var $eth = jcs:invoke( "get-ethernet-switching-interface-details" ); + jcs:printf( "%-23s%-18s%-18s%-18s%-18s%-18s%-18s", "Interface Name", "Unicast RX", "Unicast TX", "Broadcast RX", "Broadcast TX", "Multicast RX", "Multicast TX"); + + for-each ( $eth/l2ng-l2ald-iff-interface-entry/l2ng-l2ald-iff-interface-entry[l2iff-interface-flags == "SCTL"] ) { + var $sto-con-int = substring-before ( l2iff-interface-name, '.' ); + var $int-eth = $int/physical-interface[name == $sto-con-int ]/ethernet-mac-statistics; + + jcs:printf( "%-23s%-18s%-18s%-18s%-18s%-18s%-18s", $sto-con-int, $int-eth/input-unicasts, $int-eth/output-unicasts, $int-eth/input-broadcasts, $int-eth/output-broadcasts, $int-eth/input-multicasts, $int-eth/output-multicasts); + + } + } +} \ No newline at end of file diff --git a/library/juniper/op/display/storm-control/storm-control.xml b/library/juniper/op/display/storm-control/storm-control.xml new file mode 100644 index 0000000..01b9cc7 --- /dev/null +++ b/library/juniper/op/display/storm-control/storm-control.xml @@ -0,0 +1,18 @@ + +