Skip to content

Instantly share code, notes, and snippets.

Avatar

Marcel Wiget mwiget

View GitHub Profile
View xmlproxyd_krt.yang
/*
* Example yang for generating OC equivalent of internal meta tree
save as "xmlproxyd_krtState.yang" on router.
cli : show krt state
*/
module krtState {
yang-version 1;
namespace "http://juniper.net/yang/software";
@mwiget
mwiget / xmlproxyd_sysusers.yang
Last active Mar 4, 2018
User-defined Junos Telemetry Interface YANG file to stream 'show system users'
View xmlproxyd_sysusers.yang
/*
Example yang for generating OC equivalent of show system users
Requirements:
Junos Openconfig and na telemetry packages loaded:
- junos-openconfig-x86-32-0.0.0.8.tgz
- network-agent-x86-32-17.4R1.16-C1.tgz
Installation:
1) Load this file in Junos (17.3R1 or newer) with
@mwiget
mwiget / launch-docker-container.sh
Created Feb 22, 2018
Launch Docker containers like native apps with current directory (rw) mounted
View launch-docker-container.sh
#!/bin/sh
name=$(basename $0)
if [ $name == "launch-docker-container" ]; then
cat <<EOF
$0
please link this script to the container image you like to run
e.g. to launch latest alpine image with the current working directory mounted:
@mwiget
mwiget / getconfig.py
Created Aug 11, 2017
getconfig via grpc response limit
View getconfig.py
__author__ = ""
__copyright__ = "Copyright (c) 2017 Juniper Networks, Inc."
import os
from grpc.beta import implementations
import op.protos.authentication_service_pb2 as authentication_service_pb2
import op.protos.openconfig_service_pb2 as openconfig_service_pb2
import common.app_globals
import json
@mwiget
mwiget / say-hello.py
Last active May 18, 2017
fetch Junos op script from URL at startup
View say-hello.py
'''
Configure script in Junos:
set system scripts op file say-hello.py
set system scripts language python
Create an event-policy that gets triggered during startup to fetch me:
set event-options policy fetch-my-scripts events JTASK_TASK_BEGIN
set event-options policy fetch-my-scripts then execute-commands commands "request system scripts refresh-from op file say-hello.py url https://gist.githubusercontent.com/mwiget/5f77416cce02e5e3eaa9bae17fb98289/raw/3db9f896383d8fe8ca087ed1a336bfb33854095f/say-hello.py"
'''
You can’t perform that action at this time.