Skip to content

Instantly share code, notes, and snippets.

@netmanchris
netmanchris / sample.utterences
Created September 2, 2017 17:47
Alexa ServerTech PDU Sample utterences skill
YesIntent yes
YesIntent sure
AnswerIntent {first}
@netmanchris
netmanchris / intent.schema
Created September 2, 2017 17:46
Intent_schema for Alexa servertech skill
{
"intents": [
{
"intent": "YesIntent"
},
{
"slots": [
{
"name": "first",
"type": "AMAZON.NUMBER"
@netmanchris
netmanchris / templates.yaml
Created September 2, 2017 17:43
Alexa ServerTech PDU Templates YAML
welcome: Welcome to the lab. I'm going to ask you which plug you want me to turn on. Ready?
select_action: Would you like to turn a socket on or off?
select_dev: Please tell me which power socket you would like to turn on?
power_on: I've turned the power socket on.
@netmanchris
netmanchris / control_lab_power.py
Created September 2, 2017 17:42
Alexa ServerTech SNMPPDU Skill
import logging
from pyservertech.auth import *
from pyservertech.core import *
from flask import Flask, render_template
from flask_ask import Ask, statement, question, session
@netmanchris
netmanchris / bad_vlan_json_schema.py
Last active May 16, 2017 20:26
bad_vlan_json_schema.py
validate(vlan_bad, schema)
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/jsonschema/validators.py", line 541, in validate
cls(schema, *args, **kwargs).validate(instance)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/jsonschema/validators.py", line 130, in validate
raise error
jsonschema.exceptions.ValidationError: 5000 is greater than the maximum of 4094
Failed validating 'maximum' in schema['properties']['vlan_id']:
{'description': 'The unique ID of the VLAN. IEEE 802.1Q VLAN '
@netmanchris
netmanchris / good_vlan_json_schema.py
Last active May 16, 2017 19:51
validate good VLAN object using JSONSchema
from jsonschema import validate
validate(vlan_good, schema)
@netmanchris
netmanchris / vlan_json.schema.py
Last active May 16, 2017 19:43
VLAN JSON Schema Definition
schema = json.loads('''{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "VLAN configuration data.",
"title": "Vlan",
"type": "object",
"sql.max_rows": 4094,
"properties": {
"uri": {
"description": "The URI of the configuration entity",
"type": "string",
@netmanchris
netmanchris / vlan_json_output.py
Last active May 16, 2017 19:50
sample vlan json output
vlan_good = json.loads('''{
"uri": "/vlans/1",
"vlan_id": 1,
"name": "DEFAULT_VLAN",
"status": "VS_PORT_BASED",
"type": "VT_STATIC",
"is_voice_enabled": false,
"is_jumbo_enabled": false,
"is_dsnoop_enabled": false,
"is_dhcp_server_enabled": false
@netmanchris
netmanchris / gen_reservations_posh.py
Created July 24, 2016 17:06
python script to generate powershell file from Jinja2 template
'''Copyright 2015 Christopher Young ( @netmanchris )
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required'''
from jinja2 import Environment, FileSystemLoader, Template
import yaml
@netmanchris
netmanchris / reservations.csv
Created July 24, 2016 17:04
CSV File Containing DHCP client reservations for home lab network
IPAddress Name ClientId Description InitialConfigFile DHCPServer ScopeId
10.11.0.10 5400R 64-51-06-79-0c-00 Rserved for 5400R Mobile1st Branch AdpInitialConfig5400R.cfg 10.101.0.20 10.11.0.0
10.11.0.11 2920stack 74-46-a0-ff-78-e3 Reserved for 2920 Stack AdpInitialConfig2920.cfg 10.101.0.20 10.11.0.0