Skip to content

Commit

Permalink
fixing git
Browse files Browse the repository at this point in the history
  • Loading branch information
Clint Rhubart committed Mar 3, 2020
1 parent 65e3d26 commit 9619c54
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 3 deletions.
13 changes: 13 additions & 0 deletions diff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env python


import difflib, sys

with open ("file1.txt", "r") as file1:
dataset1=file1.readlines()

with open ("file2.txt", "r") as file2:
dataset1=file2.readlines()

for line in difflib.context_diff(file1, file2):
sys.stdout.write(line)
14 changes: 11 additions & 3 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
FROM debian:sid
RUN echo "building my first docker image"
CMD echo "Hello 2020 Kickoff!"
# comments
FROM python:3

ADD main.py /
ADD diff.py /
# ADD ssh.py /

RUN pip install pystrich
CMD [ "python", "./main.py" ]
CMD [ "python", "./diff.py" ]
# CMD [ "python", "./ssh.py" ]
19 changes: 19 additions & 0 deletions file1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
NY03-09-RTR-COR-PRD02# show vpc
Legend:
(*) - local vPC is down, forwarding via vPC peer-link
vPC domain id : 10
Peer status : peer adjacency formed ok
vPC keep-alive status : peer is alive
Configuration consistency status : success
Per-vlan consistency status : success
Type-2 consistency status : success
vPC role : secondary
Number of vPCs configured : 5
Peer Gateway : Enabled
Dual-active excluded VLANs : -
Graceful Consistency Check : Enabled
Auto-recovery status : Enabled, timer is off.(timeout = 240s)
Delay-restore status : Timer is off.(timeout = 30s)
Delay-restore SVI status : Timer is off.(timeout = 10s)
Operational Layer3 Peer-router : Disabled
vPC Peer-link status
19 changes: 19 additions & 0 deletions file2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
NY03-09-RTR-COR-PRD02# show vpc
Legend:
(*) - local vPC is down, forwarding via vPC peer-link
vPC domain id : 10
Peer status : peer adjacency formed ok
vPC keep-alive status : peer is alive
Configuration consistency status : success
Per-vlan consistency status : success
Type-2 consistency status : success
vPC role : secondary
Number of vPCs configured : 4
Peer Gateway : Enabled
Dual-active excluded VLANs : -
Graceful Consistency Check : Enabled
Auto-recovery status : Enabled, timer is off.(timeout = 240s)
Delay-restore status : Timer is off.(timeout = 30s)
Delay-restore SVI status : Timer is off.(timeout = 10s)
Operational Layer3 Peer-router : Disabled
vPC Peer-link status
27 changes: 27 additions & 0 deletions keypair
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAmJ2N/Pa7+yf+HzFEeLhpWY1DhdBEmGrtl+hvaImZw2/Jm5Mq
vsG5qSCMpB+yp00TnLYTIovJQuMmmgxA9eiBDw+FPwrDFUBJCM3tsZ8TCdlJSdNT
fD2z5BEoYHy5ZGA2cGPyvequbBPxJS6hQ7YJsPXyYEnTtwfPCdja24usHqNpwp7d
twsqwjpIPpFIQ3B6DSad1SF33npN+qHMS/XRgtpCLOxZFDMkjMK4Xn3jRyJvPmoQ
GWb/butzfQjws0DXImQMaUTHjmOV2we4PecQdHLtFAiUUtN0QGaSb4cmqmfQbSqU
8kP9yYv5/5uLcccVMmI3n9NgvqRoDZfv61kPNQIDAQABAoIBAG6yWTsS/GbAK2MU
qUWm/UMnY8K7vgWQCaYVwjlhFVbczq85n9edTL2QDnM9SqhvD7qrllWIbwNFH8q8
+KFlc7co2s1PUREo/9CTDcW4TGboZHBYCEYlu0XB7DeQQCi+YL5EwN1gTAO4s0D1
AaPLdlwVCSkuY5Ju542M7bIxLTdK0aaGEQTcpSyCG6zfGpyuWzpby17g6SBCWj2O
WUumcv7G8mKez/1C3y8QBg1RtyiDP6HVWNh63lTWDoqAmjhxfgPlXhx+w3Sif9PA
AvWsaBcUiOjK3RJZr2pLhDfpxPui6WsdOKcifujyu1Qs+ggiMoshh6Gq1tF2VzSV
CAsb4kECgYEAyqpgSoBxZF3HsdwZyycAFpcqk5LhR9MAcDmiO/FQJAtETHfx1NYc
JHxz5l8JxQZT81Z1iB72y39P0ly0rGWpq6rNTVac50PVidM1VXqvtXcWcMto4mxr
eePxTDblu4c8PYPgbCv2n3RpjkAWHUtYJ5ZVjiq2JAvneQcQtDwBFA8CgYEAwMdK
8T99Bw3PsGmPfSJAAbOOO782PEYt+72BYSrThn3olkT0uriERzoEQkltt78R/pfL
MzPOFmHtS/2x53QLM3ObY3fU8P07TafVXY/dUt8MhfLeOFWcRXoKWZcUYYs3cAZK
vf27twWuKNiNBcZ24lYPfZTlcRtyAi6HmJJI1HsCgYBFUNaURLADwut9EqmjyRgH
ofZG+RKiLTHWMHAjjlp5qXzXpqKIyB5iAErnvROrVom6DZUvVF/WpBmZ+mk1GaRZ
eZa0X+5UTugnNpzkOo0ERNHhDEE4SBrOWr758UDLzeo1o/hLJxI34WoE5DhsFov1
Jj7m3Abl90hZJah57Jf10wKBgQCAbIONYZkd+OJyCHCRkR6Iw6AuRzyPPMVnXiBx
pcESaJBogvlx5nggpxKtQhN4hC4tp9uzeYCCQqx9oj1BDnpjxVEwG2VdQaWfHv6x
/KQZkAPcvCWz67xWQG3irxXhwYel9lsWZJEH5R3XkiOoREVwlJpvM6ECD6GMuIiW
aGViPwKBgAP9LkfEnYElrdm5SSceAyA00HuIdWzHLJzeteUkk4KFv8CIG/vyN6u0
VEQkT6h3vbNe88FTovgqG1mtahlwhlw8EnZ74QNrd6sRowPeLV+Ci5SAGfj0pbmz
mnLGM0ilEUJ1Sba8Pg5RulN2jCu4MYSgnkHcmKI/027No+zNtavw
-----END RSA PRIVATE KEY-----
1 change: 1 addition & 0 deletions keypair.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCYnY389rv7J/4fMUR4uGlZjUOF0ESYau2X6G9oiZnDb8mbkyq+wbmpIIykH7KnTROcthMii8lC4yaaDED16IEPD4U/CsMVQEkIze2xnxMJ2UlJ01N8PbPkEShgfLlkYDZwY/K96q5sE/ElLqFDtgmw9fJgSdO3B88J2Nrbi6weo2nCnt23CyrCOkg+kUhDcHoNJp3VIXfeek36ocxL9dGC2kIs7FkUMySMwrhefeNHIm8+ahAZZv9u63N9CPCzQNciZAxpRMeOY5XbB7g95xB0cu0UCJRS03RAZpJvhyaqZ9BtKpTyQ/3Ji/n/m4txxxUyYjef02C+pGgNl+/rWQ81 [email protected]
24 changes: 24 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env python

import difflib, sys
from termcolor import cprint

def compare (a,b):
if a != b:
cprint ('ALERT: INVESTIGATION REQUIRED', 'white', 'on_red')
cprint ('Detailed diff below', 'red')
for line in difflib.context_diff(a, b):
sys.stdout.write(line)
elif a == b:
cprint ('ALL IS GOOD', 'green')
else:
cprint ('BAD DATASETS')

if __name__ == '__main__':
with open ("file1.txt", "r") as file1:
dataset1=file1.readlines()

with open ("file2.txt", "r") as file2:
dataset2=file2.readlines()

compare (dataset1, dataset2)
14 changes: 14 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[build-system]
build-backend = "poetry.masonry.api"
requires = ["poetry>=0.12"]

[tool]
[tool.poetry]
authors = ["ccfs-crhubart <[email protected]>"]
description = ""
name = "clint-2020-kickoff-1"
version = "0.1.0"
[tool.poetry.dependencies]
python = "^3.7"
termcolor = "^1.1"
[tool.poetry.dev-dependencies]
37 changes: 37 additions & 0 deletions ssh.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/pkg/bin/python

#Importing modules
import paramiko
import sys
import time

#setting parameters like host IP, username, passwd and number of iterations to gather cmds
HOST = "192.168.7.113"
USER = ""
PASS = ""
ITERATION = 3

#A function that logins and execute commands
def fn():
client1=paramiko.SSHClient()
#Add missing client key
client1.set_missing_host_key_policy(paramiko.AutoAddPolicy())
#connect to switch
client1.connect(HOST,username=USER,password=PASS)
print "SSH connection to %s established" %HOST
#Gather commands and read the output from stdout
stdin, stdout, stderr = client1.exec_command('show version\n')
print stdout.read()
stdin, stdout, stderr = client1.exec_command('show alarms | no-more\n')
print stdout.read()
stdin, stdout, stderr = client1.exec_command( 'show processes memory | no-more\n')
print stdout.read()
client1.close()
print "Logged out of device %s" %HOST

#for loop to call above fn x times. Here x is set to 3
for x in xrange(ITERATION):
fn()
print "%s Iteration/s completed" %(x+1)
print "********"
time.sleep(5) #sleep for 5 seconds

0 comments on commit 9619c54

Please sign in to comment.