Skip to content

Instantly share code, notes, and snippets.

View mathershifter's full-sized avatar

Jesse Mather mathershifter

View GitHub Profile
@mathershifter
mathershifter / gonso.go
Last active April 15, 2020 23:01
Experimenting with sockets in a namespace
// +build go1.10
// Demo listening on a socket inside an network namespace
package main
import (
"bufio"
"fmt"
"net"
@mathershifter
mathershifter / demohttpserver.go
Created September 30, 2019 18:23
Go DEMO HTTP server
// Copyright (c) 2019 Arista Networks, Inc.
// Use of this source code is governed by the Apache License 2.0
// that can be found in the COPYING file.
package main
import (
"fmt"
"io/ioutil"
"log"
@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 \
#!/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 / 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
#!/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

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"
@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
#!/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:**
# -*- 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: