예제 #1
0
def list_orgs():
    orgs = json_reader("../../config/safeway-orgs.json")
    EOM()
    print(" " * 38, "ORGS")
    for org in orgs:
        print("Org:{}\t\t\tId:{}".format(org["name"], org["id"]))
    EOM()
예제 #2
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def test_function(self):
     os.chdir("{}/automation".format(self.cwd))
     from api.netx import test
     EOM()
     test()
     print("# funnel file has been upgraded #")
     os.chdir("{}".format(self.cwd))
     EOM()
     print("")
예제 #3
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def get_funnel(self):
     os.chdir("{}/automation".format(self.cwd))
     from api.men_and_mice import get_and_convert_funnel
     get_and_convert_funnel()
     EOM()
     print("# funnel file has been updated #")
     os.chdir("{}".format(self.cwd))
     EOM()
     print("")
예제 #4
0
def show_status():
    EOM()
    print(wiki.doc)
    store_name = settings["store-name"]
    load_store("orchestration_store", store_name)
    EOM()
    print("org   : {}\n"
          "org-id: {}".format(settings["org-name"], settings["orgid"]))
    netid = settings["netid"]
    print("store : {}\n" "netid : {}".format(settings["store-name"], netid))
    EOM()
    print("_" * 80)
예제 #5
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
    def get_settings_vlans_delete(self):
        os.chdir("{}/automation".format(self.cwd))
        cli_settings = settings["CLI"]
        EOM()
        print("# deploy vlans-delete settings #")
        for key in cli_settings:
            if key.find("vlans-delete") == 0:
                print("{}:  {}".format(key, cli_settings[key]))

        os.chdir("{}".format(self.cwd))
        EOM()
        print("")
예제 #6
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
    def get_settings_l3fwrules(self):
        os.chdir("{}/automation".format(self.cwd))
        cli_settings = settings["CLI"]
        EOM()
        print("# l3fwrules settings #")
        for key in cli_settings:
            if key.find("l3fwrules") == 0:
                print("{}:  {}".format(key, cli_settings[key]))

        os.chdir("{}".format(self.cwd))
        EOM()
        print("")
예제 #7
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
    def get_settings_store_lists(self):
        os.chdir("{}/automation".format(self.cwd))
        cli_settings = settings["CLI"]
        EOM()
        print("# store-lists settings #")
        for key in cli_settings:
            if key.find("store-lists") == 0:
                print("{}:  {}".format(key, cli_settings[key]))

        os.chdir("{}".format(self.cwd))
        EOM()
        print("")
예제 #8
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def set_s2svpnrules_version(self, version):
     os.chdir("{}/automation".format(self.cwd))
     if self.validate_s2svpnrules_version(version) is False:
         return
     print("\n\n# selected s2svpnrules-version: #\n{}".format(version))
     set_cli_selections("s2svpnrules-version", version)
     EOM()
예제 #9
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def set_s2svpnrules_org(self, org_name):
     os.chdir("{}/automation".format(self.cwd))
     if self.validate_org_list(org_name) is False:
         return
     print("\n\n# selected s2svpnrules-org: #\n{}".format(org_name))
     set_cli_selections("s2svpnrules-org", org_name)
     EOM()
예제 #10
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def set_store_lists_org(self, org_name):
     os.chdir("{}/automation".format(self.cwd))
     if self.validate_org_list(org_name) is False:
         return
     print("\n\n# Selected store-lists-org #\n{}".format(org_name))
     set_cli_selections("store-lists-org", org_name)
     EOM()
예제 #11
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def set_networks_serials(self, serials):
     os.chdir("{}/automation".format(self.cwd))
     if self.validate_serials(serials) is False:
         return
     print("\n\n# Selected networks-serials #\n{}".format(serials))
     set_cli_selections("networks-serials", serials)
     EOM()
예제 #12
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def set_vlans_delete_list(self, vlans_delete_list):
     os.chdir("{}/automation".format(self.cwd))
     if self.validate_vlans_delete_list(vlans_delete_list) is False:
         return
     print("\n\n# Selected vlans-delete-list #\n{}".format(vlans_delete_list))
     set_cli_selections("vlans-delete-list", vlans_delete_list)
     EOM()
예제 #13
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def set_vlans_delete_org(self, org_name):
     os.chdir("{}/automation".format(self.cwd))
     if self.validate_org_list(org_name) is False:
         return
     print("\n\n# Selected vlans-delete-org #\n{}".format(org_name))
     set_cli_selections("vlans-delete-org", org_name)
     EOM()
예제 #14
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def deploy_networks(self):
     """Runs the store orchestration"""
     from automation.network_handler import bulk_deploy_networks_for_all_orgs
     bulk_deploy_networks_for_all_orgs(agent="cli-deploy-networks")
     sys.stdout.flush()
     time.sleep(1)
     EOM()
예제 #15
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def set_run_normal(self):
     """Selects normal run mode which makes meraki api calls"""
     os.chdir("{}/automation".format(self.cwd))
     set_cli_selections("dry-run", False)
     print("\n\n# selected run-normal #")
     os.chdir("{}".format(self.cwd))
     EOM()
예제 #16
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def set_l3fwrules_store_list(self, store_list):
     os.chdir("{}/automation".format(self.cwd))
     if self.validate_store_list(store_list) is False:
         return
     print("\n\n# selected l3fwrules-store-list: #\n{}".format(store_list))
     set_cli_selections("l3fwrules-store-list", store_list)
     EOM()
예제 #17
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def set_networks_clone_source(self, clone_source):
     os.chdir("{}/automation".format(self.cwd))
     if self.validate_clone_source(clone_source) is False:
         return
     print("\n\n# Selected networks-clone-source #\n{}".format(clone_source))
     set_cli_selections("networks-clone-source", clone_source)
     EOM()
예제 #18
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def deploy_s2svpnrules(self):
     """Runs vpn firewall bulk update"""
     import automation.vpn_firewall_handler as vpn_firewall_handler
     agent = "cli-deploy-s2svpnrules"
     vpn_firewall_handler.bulk_update(agent)
     sys.stdout.flush()
     time.sleep(1)
     EOM()
예제 #19
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def set_networks_org(self, org_name):
     os.chdir("{}/automation".format(self.cwd))
     if self.validate_org_list(org_name) is False:
         return
     print("\n\n# Selected networks/sites-org #\n{}".format(org_name))
     set_cli_selections("networks-org", org_name)
     set_cli_selections("sites-org", org_name)
     EOM()
예제 #20
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def set_networks_store_list(self, store_list):
     os.chdir("{}/automation".format(self.cwd))
     if self.validate_store_list(store_list) is False:
         return
     print("\n\n# Selected networks/sites-store-list #\n{}".format(store_list))
     set_cli_selections("networks-store-list", store_list)
     set_cli_selections("sites-store-list", store_list)
     EOM()
예제 #21
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def deploy_vlans_add(self):
     """Runs the store orchestration"""
     from automation.sites_handler import bulk_update_vlans
     agent = "cli-deploy-vlans-add"
     bulk_update_vlans(agent)
     sys.stdout.flush()
     time.sleep(1)
     EOM()
예제 #22
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def deploy_l3fwrules(self):
     """Runs the store orchestration"""
     from automation.firewall_handler import bulk_update
     agent = "cli-deploy-l3fwrules"
     bulk_update(agent=agent)
     sys.stdout.flush()
     time.sleep(1)
     EOM()
예제 #23
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def deploy_vlans_delete(self):
     """Runs the store orchestration"""
     from automation.sites_handler import bulk_update
     agent = "cli-deploy-vlans-delete"
     bulk_update(agent, vlans_only=True)
     sys.stdout.flush()
     time.sleep(1)
     EOM()
예제 #24
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def how_to(self, config=None, templates=None, commands=None):
     """Shows all the possible how tos for these automation scripts"""
     os.chdir("{}/automation".format(self.cwd))
     from utils.auto_doc import howto
     howto(config, templates, commands)
     os.chdir("{}".format(self.cwd))
     sys.stdout.flush()
     time.sleep(1)
     EOM()
예제 #25
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def set_run_dry(self):
     """This is the default and selects dry-run mode which bypaasses meraki api calls ,
     It is useful to verify valid org name, store id and that the scripts are running
     okay. This will generate all the logs also on ./data/<fname>.log"""
     os.chdir("{}/automation".format(self.cwd))
     set_cli_selections("dry-run", True)
     print("\n\n# selected run-dry #")
     os.chdir("{}".format(self.cwd))
     EOM()
예제 #26
0
def doc(design=None,
        automation=None,
        automation_vlan=None,
        automation_firewall=None,
        automation_vpn_handler=None,
        api=None,
        api_vlans=None,
        api_meraki=None,
        api_netx=None,
        config=None,
        utils=None,
        men_and_mice=None,
        data=None):

    EOM()
    print(wiki.doc)
    EOM()
    if design == True or design == "design":
        print(wiki.doc_design)
    if automation == True or design == "automation":
        print(wiki.doc_automation)
    if automation_vlan == True or design == "automation_vlan":
        print(wiki.doc_automation_vlan)
    if automation_firewall == True or design == "automation_firewall":
        print(wiki.doc_automation_firewall)
    if automation_vpn_handler == True or design == "automation_vpn_handler":
        print(wiki.doc_automation_vpn_handler)
    if api == True or design == "api":
        print(wiki.doc_api)
    if api_vlans == True or design == "api_vlans":
        print(wiki.doc_api_vlans)
    if api_meraki == True or design == "api_meraki":
        print(wiki.doc_api_meraki)
    if api_netx == True or design == "api_netx":
        print(wiki.doc_api_netx)
    if config == True or design == "config":
        print(wiki.doc_config)
    if utils == True or design == "utils":
        print(wiki.doc_utils)
    if men_and_mice == True or design == "men_and_mice":
        print(wiki.doc_men_and_mice)
    if data == True or design == "data":
        print(wiki.doc_data)
예제 #27
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def validate_org_list(self, org_name):
     print("# List of valid Orgs available #")
     orgs = find_file_pattern("org-")
     if org_name not in orgs:
         if not (org_name in valid_queries):
             print('"{}" is not a valid org, please select of the orgs from above.'.format(org_name))
         EOM()
         sys.stdout.flush()
         return False
     return True
예제 #28
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def validate_store_list(self, store_list):
     print("# List of valid Store-lists available")
     store_lists = find_file_pattern("store-list")
     if store_list not in store_lists:
         if not (store_list in valid_queries):
             print('"{}" is not a valid store-list, please select a valid store-list from above.'.format(store_list))
         EOM()
         sys.stdout.flush()
         return False
     return True
예제 #29
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def validate_vlans_delete_list(self, vlans_delete_list):
     print("# List of valid vlans-delete-lists available")
     vlans_delete_lists = find_file_pattern("vlans-delete-list-", "csv")
     if vlans_delete_list not in vlans_delete_lists:
         if not (vlans_delete_list in valid_queries):
             print('"{}" is not a valid vlans-delete-list, please select a vlans-delete-list from above.'.format(
                 vlans_delete_list))
         EOM()
         sys.stdout.flush()
         return False
     return True
예제 #30
0
파일: cli.py 프로젝트: rloza08/NSMK-Code
 def get_s2svpnrules(self):
     """Runs the store orchestration"""
     os.chdir("{}/automation".format(self.cwd))
     from utils.auto_logger import init_logger
     init_logger()
     from automation.vpn_firewall_handler import bulk_get
     agent = "cli-get-s2svpnrules"
     bulk_get(agent=agent)
     sys.stdout.flush()
     time.sleep(1)
     EOM()