Skip to content

Instantly share code, notes, and snippets.

View mathershifter's full-sized avatar

Jesse Mather mathershifter

View GitHub Profile
@mathershifter
mathershifter / eos_ssh.py
Last active August 29, 2015 14:06
A simple SSH module with predefined prompts for Arists EOS CLI and bash modes
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Arista Networks, Inc. All rights reserved.
# Arista Networks, Inc. Confidential and Proprietary.
r"""
Simple SSH client library or utility if run directly.
-----------------------------------------------------
**Examples:**
#!/usr/bin/env python
import collections
class ResolvingDict(collections.MutableMapping):
"""Find a key in current or parent node"""
def __init__(self, mapping, parent=None):
self.store = dict()
self.update(mapping)
self.parent = parent
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Arista Networks, Inc. All rights reserved.
# Arista Networks, Inc. Confidential and Proprietary.
"""
Display PFC counter delta. First run will simply display current values
Requires:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Arista Networks, Inc. All rights reserved.
# Arista Networks, Inc. Confidential and Proprietary.
r"""
Simple SSH client library or utility if run directly.
-----------------------------------------------------
**Examples:**
@mathershifter
mathershifter / eapilib.py
Last active February 21, 2018 01:41
EAPI example with login endpoint
# moved to: https://github.com/arista-northwest/eapi-py

Configuring SSL certificate/key pairs

Option 1: Generate certificate/key pairs (OpenSSL on Linux)

$ openssl req -new -nodes -x509 -days 365 \
  -out eapi_server_veos1.crt \
  -keyout eapi_server_veos1.key \
  -subj "/C=US/ST=Washington/L=Seattle/O=Arista Networks/OU=Arsita Northwest/CN=veos1.veoslab.lan"
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Arista Networks, Inc. All rights reserved.
# Arista Networks, Inc. Confidential and Proprietary.
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import collections
import os
import re
@mathershifter
mathershifter / arstat_client.py
Last active April 2, 2018 16:44
Sample client for arstat
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2018 Arista Networks, Inc. All rights reserved.
# Arista Networks, Inc. Confidential and Proprietary.
from __future__ import print_function
import sys
import time
import json
#!/bin/bash
# Credit to Sudip Regmi <[email protected]>
create_ceos() {
docker create --name=$1 --privileged \
-e CEOS=1 \
-e container=docker \
-e EOS_PLATFORM=ceoslab \
-e SKIP_ZEROTOUCH_BARRIER_IN_SYSDBINIT=1 \
@mathershifter
mathershifter / eapi_ca_certs.md
Last active June 12, 2019 18:26
eAPI CA certs

CA Root

cd /root/ca
openssl genrsa -out private/ca.key.pem 4096
chmod 400 private/ca.key.pem

openssl req -config openssl.cnf \
      -key private/ca.key.pem \