Skip to content

Commit

Permalink
Added a lot more code
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffsilverm committed Dec 7, 2019
1 parent f59da4a commit fd4d3ee
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions nbmdt_simple.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#! /usr/bin/env python3
# -*- coding: utf-8 -*-

import subprocess
from time import sleep


INET="-4"
INET6="-6"


BORDER_GATEWAY_4 = "96.120.102.161"
BORDER_GATEWAY_6 = "2001:558:4082:5c::1"

Expand All @@ -21,6 +25,25 @@ def main():
verify_ping_6 = ping(default_gateway_6, INET6`)
report("IPv6 default gateway pingable", green=(verify_ping_6 == 1.0), yellow=(verify_ping_6 < 1.0 and verify_ping_4 > 0.0), red = (verify_ping_4 == 0.0) )

def ping(host, protocol):

def report(explanation: str="Not specified", red: bool =False, yellow:
bool =False, green: bool =False):
"""
explanation: str A descriptive string
red: bool True if status should be red
yellow: bool True if status should be yellow. If not specified, the default
is False so the answer must be RED or GREEN
green: bool True if status should be green
This is done this way to shift complexity to the subroutine
"""
if int(red) + int(yellow) + int(green) > 1:
raise ValueError("More than one of red, yellow, or green was set to True") status = ("RED" if red else ("YELLOW" if yellow else ("GREEN" if green else \
"UNKNOWN") ) )
print(f"{explanation}: {status}")

def ping(


if "__main__" == __name__:
while True do:
Expand Down
Empty file removed nmbdt_simple.py
Empty file.

0 comments on commit fd4d3ee

Please sign in to comment.