Exemplo n.º 1
0
    def test_015_range_assign_fingerprint_Filter_Deny(self):
        print("Edit the range and assign fingerprint filter to Deny")
        get_ref = ib_NIOS.wapi_request(
            'GET', object_type='range?_return_fields=fingerprint_filter_rules')
        data = {
            "fingerprint_filter_rules": [{
                "filter": "Fingerprint",
                "permission": "Deny"
            }]
        }
        stat_range = "10.0.0.1"

        for ref in json.loads(get_ref):
            if stat_range in ref['_ref']:
                response = ib_NIOS.wapi_request('PUT',
                                                ref=ref['_ref'],
                                                fields=json.dumps(data))
                print(response)
                if type(response) == tuple:
                    if response[0] == 400 or response[0] == 401:
                        print(
                            "Failure: Edit the range and assign fingerprint filter to Deny"
                        )
                        assert False
                    else:
                        print(
                            "Success: Edit the range and assign fingerprint filter to Deny"
                        )
                        assert True
 def test_3_address_diagnostic_FC_discovery_gridproperties(self):
     get_ref = ib_NIOS.wapi_request('GET',
                                    object_type="discovery:gridproperties")
     logging.info(get_ref)
     res = json.loads(get_ref)
     ref = json.loads(get_ref)[0]['_ref']
     print ref
     logging.info(
         "Test the address field with diagnostic function call in discovery:gridproperties object"
     )
     data = {
         "address": True,
         "community_string": "qasnmp",
         "discovery_member": "nd.member.com",
         "force_test": False,
         "network_view": "default"
     }
     status, response = ib_NIOS.wapi_request('POST',
                                             object_type=ref,
                                             params="?_function=diagnostic",
                                             fields=json.dumps(data))
     print response
     print status
     logging.info(response)
     assert status == 400 and re.search(
         r'AdmConProtoError: Invalid value for address: true: Must be string type',
         response)
     logging.info("Test Case 3 Execution Completed")
     logging.info("============================")
Exemplo n.º 3
0
 def test_109_stop_and_start_DCA_service(self):
     display_msg("Restarting DCA service in the Grid Master...\n")
     get_ref = ib_NIOS.wapi_request('GET', object_type="member:dns", grid_vip=config.grid_vip)
     logging.info(get_ref)
     res = json.loads(get_ref)
     ref1 = json.loads(get_ref)[0]['_ref']
     data = {"enable_dns_cache_acceleration": False}
     response = ib_NIOS.wapi_request('PUT',ref=ref1,fields=json.dumps(data), grid_vip=config.grid_vip)
     sleep(10)
     logging.info(response)
     print (response)
     sleep(20)
     print("DCA service stopped")
     print("Starting DCA service")
     get_ref = ib_NIOS.wapi_request('GET', object_type="member:dns", grid_vip=config.grid_vip)
     logging.info(get_ref)
     res = json.loads(get_ref)
     ref1 = json.loads(get_ref)[0]['_ref']
     print ref1
     data = {"enable_dns": True,"enable_dns_cache_acceleration": True}
     response = ib_NIOS.wapi_request('PUT',ref=ref1,fields=json.dumps(data), grid_vip=config.grid_vip)
     sleep(10)
     logging.info(response)
     print (response)
     sleep(60)
     print("DCA service restarted in the Grid Master.")
Exemplo n.º 4
0
 def test_002_create_A_record(self):
     print("Creating A RR in test zone")
     data = {
         "ipv4addr": "13.0.0.1",
         "view": "default",
         "name": "A_rec.rfe_niosspt_10056.com"
     }
     response = ib_NIOS.wapi_request('POST',
                                     object_type="record:a",
                                     fields=json.dumps(data))
     print(response)
     if type(response) == tuple:
         if response[0] == 400 or response[0] == 401:
             print("Failure: Create A record in test zone")
             assert False
     print("Restart Services")
     grid = ib_NIOS.wapi_request('GET',
                                 object_type="grid",
                                 grid_vip=config.grid_vip)
     ref = json.loads(grid)[0]['_ref']
     data = {
         "member_order": "SIMULTANEOUSLY",
         "restart_option": "FORCE_RESTART",
         "service_option": "ALL"
     }
     request_restart = ib_NIOS.wapi_request('POST',
                                            object_type=ref +
                                            "?_function=restartservices",
                                            fields=json.dumps(data),
                                            grid_vip=config.grid_vip)
     sleep(30)
    def test_006_disable_custom_views(self):
        get_ref = ib_NIOS.wapi_request('GET', object_type='view')
        for ref in json.loads(get_ref):
            if 'Cusmt1' in ref['_ref']:
                data = {"disable": True}
                response = ib_NIOS.wapi_request('PUT',
                                                ref=ref['_ref'],
                                                fields=json.dumps(data))
                print(response)
                if type(response) == tuple:
                    if response[0] == 400 or response[0] == 401:
                        print("Failure: disable custom view")
                        assert False
                    else:

                        print("Success: disable custom view")
                        assert True

        print("Restart Services")
        grid = ib_NIOS.wapi_request('GET',
                                    object_type="grid",
                                    grid_vip=config.grid_vip)
        ref = json.loads(grid)[0]['_ref']
        data = {
            "member_order": "SIMULTANEOUSLY",
            "restart_option": "FORCE_RESTART",
            "service_option": "ALL"
        }
        request_restart = ib_NIOS.wapi_request('POST',
                                               object_type=ref +
                                               "?_function=restartservices",
                                               fields=json.dumps(data),
                                               grid_vip=config.grid_vip)
        sleep(20)
        assert True
    def test_005_cleanup_object(self):
        get_ref = ib_NIOS.wapi_request('GET',
                                       object_type="zone_auth",
                                       grid_vip=config.grid_vip)
        for ref in json.loads(get_ref):
            response = ib_NIOS.wapi_request('DELETE', ref=ref['_ref'])

            print(response)

            if type(response) == tuple:

                if response[0] == 400 or response[0] == 401:

                    assert False
                else:
                    assert True
        print("Restart DHCP Services")
        grid = ib_NIOS.wapi_request('GET',
                                    object_type="grid",
                                    grid_vip=config.grid_vip)
        ref = json.loads(grid)[0]['_ref']
        data = {
            "member_order": "SIMULTANEOUSLY",
            "restart_option": "FORCE_RESTART",
            "service_option": "ALL"
        }
        request_restart = ib_NIOS.wapi_request('POST',
                                               object_type=ref +
                                               "?_function=restartservices",
                                               fields=json.dumps(data),
                                               grid_vip=config.grid_vip)
        sleep(20)
    def test_002_create_custom_views1(self):
        data = {"name": "Cusmt1"}
        response = ib_NIOS.wapi_request('POST',
                                        object_type="view",
                                        fields=json.dumps(data))
        print(response)
        if type(response) == tuple:
            if response[0] == 400 or response[0] == 401:
                print("Failure: Create custom view")
                assert False
            else:

                print("Success: Create custom view")
                assert True
        print("Restart Services")
        grid = ib_NIOS.wapi_request('GET',
                                    object_type="grid",
                                    grid_vip=config.grid_vip)
        ref = json.loads(grid)[0]['_ref']
        data = {
            "member_order": "SIMULTANEOUSLY",
            "restart_option": "FORCE_RESTART",
            "service_option": "ALL"
        }
        request_restart = ib_NIOS.wapi_request('POST',
                                               object_type=ref +
                                               "?_function=restartservices",
                                               fields=json.dumps(data),
                                               grid_vip=config.grid_vip)
        sleep(30)
Exemplo n.º 8
0
 def test_008_import_zone(self):
     get_ref = ib_NIOS.wapi_request('GET', object_type='zone_auth')
     print(get_ref)
     for ref in json.loads(get_ref):
         if 'rfe_niosspt_10056.com' in ref['_ref']:
             print(ref['_ref'])
             data = {
                 "use_import_from": True,
                 "import_from": "255.255.255.255",
                 "do_host_abstraction": True
             }
             response = ib_NIOS.wapi_request('PUT',
                                             ref=ref['_ref'],
                                             fields=json.dumps(data))
             print(response)
             if type(response) == tuple:
                 if response[0] == 400 or response[0] == 401:
                     print("Failure: Import record from zone of test FMZ")
                     assert False
     print("Restart Services")
     grid = ib_NIOS.wapi_request('GET',
                                 object_type="grid",
                                 grid_vip=config.grid_vip)
     ref = json.loads(grid)[0]['_ref']
     data = {
         "member_order": "SIMULTANEOUSLY",
         "restart_option": "FORCE_RESTART",
         "service_option": "ALL"
     }
     request_restart = ib_NIOS.wapi_request('POST',
                                            object_type=ref +
                                            "?_function=restartservices",
                                            fields=json.dumps(data),
                                            grid_vip=config.grid_vip)
     sleep(30)
    def test_003_add_a_DTC_lbdn(self):
        print("Create A DTC LBDN")

        get_ref_pool = ib_NIOS.wapi_request('GET',
                                            object_type="dtc:pool",
                                            grid_vip=config.grid_vip)
        pool_lst = []
        ind = 1
        for ref in json.loads(get_ref_pool):
            print(ref['_ref'])
            if 'p1' in ref['_ref']:
                pool_lst.append({"pool": ref['_ref'], "ratio": ind})
                ind = ind + 1

        get_ref_zones = ib_NIOS.wapi_request('GET',
                                             object_type="zone_auth",
                                             grid_vip=config.grid_vip)
        zone_lst = []
        for ref in json.loads(get_ref_zones):
            print(ref['_ref'])
            if 'test_s.com' in ref['_ref']:
                zone_lst.append(ref['_ref'])

        print(pool_lst, zone_lst)
        data = {
            "name": "one",
            "lb_method": "ROUND_ROBIN",
            "patterns": ["arec.test_s.com"],
            "pools": pool_lst,
            "auth_zones": zone_lst,
            "types": ["A", "AAAA", "CNAME", "NAPTR"]
        }
        response = ib_NIOS.wapi_request('POST',
                                        object_type="dtc:lbdn",
                                        fields=json.dumps(data))
        print response
        if type(response) == tuple:
            if response[0] == 400 or response[0] == 401:
                print("Failure: Create A DTC LBDN")
                assert False
            else:
                print("Success: Create A DTC LBDN")
                assert True

        print("Restart DHCP Services")
        grid = ib_NIOS.wapi_request('GET',
                                    object_type="grid",
                                    grid_vip=config.grid_vip)
        ref = json.loads(grid)[0]['_ref']
        data = {
            "member_order": "SIMULTANEOUSLY",
            "restart_option": "FORCE_RESTART",
            "service_option": "ALL"
        }
        request_restart = ib_NIOS.wapi_request('POST',
                                               object_type=ref +
                                               "?_function=restartservices",
                                               fields=json.dumps(data),
                                               grid_vip=config.grid_vip)
        sleep(20)
Exemplo n.º 10
0
    def test_010_Server1_is_up_Server2_is_down(self):
        print("Server1_is_up_Server2_is_down")

        get_ref = ib_NIOS.wapi_request(
            'GET',
            object_type="dtc:server?_return_fields=health,disable",
            grid_vip=config.grid_vip)
        print(get_ref)
        for ref in json.loads(get_ref):
            if 'server1' in ref['_ref']:

                print("Server1:Color=" + ref['health']['availability'] +
                      " Server1:Status=" + ref['health']['enabled_state'])

                data = {
                    "health": {
                        "availability": "RED",
                        "enabled_state": "Error"
                    }
                }
                response = ib_NIOS.wapi_request('PUT',
                                                ref=ref['_ref'],
                                                fields=json.dumps(data))
                print(response)
                if type(response) == tuple:
                    if response[0] == 400 or response[0] == 401:
                        print("Failure: Server1_is_up_Server2_is_down")
                        assert False
                    else:
                        print("Success: Server1_is_up_Server2_is_down")
                        assert True
 def test_1_diagnostic_FC_discovery_gridproperties(self):
     get_ref = ib_NIOS.wapi_request('GET',
                                    object_type="discovery:gridproperties")
     logging.info(get_ref)
     res = json.loads(get_ref)
     ref = json.loads(get_ref)[0]['_ref']
     print ref
     logging.info(
         "Test the diagnostic function call in discovery:gridproperties object"
     )
     data = {
         "address": "10.40.16.10",
         "community_string": "qasnmp",
         "discovery_member": "nd.member.com",
         "force_test": False,
         "network_view": "default"
     }
     response = ib_NIOS.wapi_request('POST',
                                     object_type=ref,
                                     params="?_function=diagnostic",
                                     fields=json.dumps(data))
     print response
     logging.info(response)
     read = re.search(r'200', response)
     for read in response:
         assert True
     logging.info("Test Case 1 Execution Completed")
     logging.info("============================")
 def test_8_start_diagnostic_status_FC_discovery_gridproperties(self):
     get_ref = ib_NIOS.wapi_request('GET',
                                    object_type="discovery:gridproperties")
     logging.info(get_ref)
     res = json.loads(get_ref)
     ref = json.loads(get_ref)[0]['_ref']
     print ref
     logging.info(
         "Test the start field with diagnostic_status function call in discovery:gridproperties object"
     )
     data = {
         "session_id": "6caf4dbb-5aaf-4a9e-90fc-8128234ba08c",
         "start": True
     }
     status, response = ib_NIOS.wapi_request(
         'POST',
         object_type=ref,
         params="?_function=diagnostic_status",
         fields=json.dumps(data))
     print response
     print status
     logging.info(response)
     assert status == 400 and re.search(
         r'AdmConProtoError: Invalid value for start: true: Must be integer type',
         response)
     logging.info("Test Case 8 Execution Completed")
     logging.info("============================")
Exemplo n.º 13
0
    def test_007_cleanup_objects(self):
        get_ref = ib_NIOS.wapi_request('GET',
                                       object_type="zone_auth",
                                       grid_vip=config.grid_vip)
        for ref in json.loads(get_ref):
            response = ib_NIOS.wapi_request('DELETE', ref=ref['_ref'])

            print(response)

            if type(response) == tuple:

                if response[0] == 400 or response[0] == 401:

                    assert False
                else:
                    assert True
        get_ref = ib_NIOS.wapi_request('GET',
                                       object_type="nsgroup",
                                       grid_vip=config.grid_vip)
        for ref in json.loads(get_ref):
            response = ib_NIOS.wapi_request('DELETE', ref=ref['_ref'])

            print(response)

            if type(response) == tuple:

                if response[0] == 400 or response[0] == 401:

                    assert False
                else:
                    assert True
Exemplo n.º 14
0
    def test_003_cleanup_created_objects(self):
        print("Clean up all created objects")
	get_ref = ib_NIOS.wapi_request('GET', object_type='member:dns?_return_fields=recursive_resolver', grid_vip=config.grid_vip)
        print("\n")
        for ref in json.loads(get_ref):
            data={"recursive_resolver":"BIND"}
            response = ib_NIOS.wapi_request('PUT', ref=ref['_ref'], fields=json.dumps(data), grid_vip=config.grid_vip)
            print(response)

            if type(response) == tuple:
                if response[0]==400 or response[0]==401 or response[0]==404:
                    print("Success: Do not set to recursive resolver")
                    assert True
                else:
                    print("Failure: DO not set to recursive resolver")
                    assert False
        get_ref = ib_NIOS.wapi_request('GET', object_type='grid:dns?_return_fields=forwarders,allow_recursive_query', grid_vip=config.grid_vip)
        print(get_ref)
        for ref in json.loads(get_ref):
            data = {"allow_recursive_query": False, "forwarders": []}
            response = ib_NIOS.wapi_request('PUT', ref=ref['_ref'], fields=json.dumps(data), grid_vip=config.grid_vip)
            print(response)

            if type(response) == tuple:
                if response[0]==400 or response[0]==401 or response[0]==404:
                    print("Success: NO forwarder as client ip and disable recursion")
                    assert True
                else:
                    print("Failure: No forwarder as client ip and disable recursion")
                    assert False
 def test_000_start_dns_services(self):
    print("Start DNS service")
    get_ref = ib_NIOS.wapi_request('GET', object_type='member:dns')
    print(get_ref)
    for ref in json.loads(get_ref):
        response = ib_NIOS.wapi_request('PUT', ref=ref['_ref'], fields=json.dumps({"enable_dns":True}))
        if type(response) == tuple:
            if response[0]==400 or response[0]==401:
                assert False
Exemplo n.º 16
0
 def test_108_add_dns_forwarder(self):
     display_msg("Adding DNS forwarder : 10.0.2.35 to the Grid Master...")
     grid_dns_ref = ib_NIOS.wapi_request('GET', object_type='grid:dns')
     data = {"forwarders":["10.0.2.35"]}
     response = ib_NIOS.wapi_request('PUT', ref=json.loads(grid_dns_ref)[0]['_ref'], fields=json.dumps(data))
     if type(response) == tuple:
         if response[0]==400 or response[0]==401:
             display_msg("Failure: Adding DNS Forwarder")
             assert False
         else:
             assert True
 def test_007_change_the_NSG_Group(self):  
     get_ref = ib_NIOS.wapi_request('GET', object_type='zone_auth')
     for ref in json.loads(get_ref):
         if 'sub.testing.com' in ref['_ref']:
             data={"ns_group": "NSG_2"}
             response = ib_NIOS.wapi_request('PUT', ref=ref['_ref'], fields=json.dumps(data),grid_vip=config.grid_vip)
             print(response)
             if type(response) == tuple:
                 if response[0]==400 or response[0]==401 or response[0]==404:
                     print("Failure: Change the NSG group ")
                     assert False
Exemplo n.º 18
0
 def test_101_start_DCA_service(self):
     display_msg("starting DCA service in the Grid member...\n")
     get_ref = ib_NIOS.wapi_request('GET', object_type="member:dns", grid_vip=config.grid_vip)
     logging.info(get_ref)
     res = json.loads(get_ref)
     ref1 = json.loads(get_ref)[1]['_ref']
     data = {"enable_dns": True,"enable_dns_cache_acceleration": True}
     response = ib_NIOS.wapi_request('PUT',ref=ref1,fields=json.dumps(data), grid_vip=config.grid_vip)
     sleep(10)
     print (response)
     sleep(30)
     print("DCA service started in the Grid member")
Exemplo n.º 19
0
 def test_000_start_IPv4_DHCP_service(self):
     print("Enable the DPCH service")
     get_ref = ib_NIOS.wapi_request(
         'GET',
         object_type="member:dhcpproperties?_return_fields=enable_dhcp",
         grid_vip=config.grid_vip)
     ref = json.loads(get_ref)[0]['_ref']
     data = {"enable_dhcp": True}
     response = ib_NIOS.wapi_request('PUT',
                                     ref=ref,
                                     fields=json.dumps(data),
                                     grid_vip=config.grid_vip)
     print(response)
Exemplo n.º 20
0
    def test_008_assign_servers_to_pool_monitor(self):
        print("Assign_servers_to_pool_monitor")
        get_ref = ib_NIOS.wapi_request('GET',
                                       object_type="dtc:monitor:http",
                                       grid_vip=config.grid_vip)
        monitor = ""
        for ref in json.loads(get_ref):
            if not 'https' in ref['_ref']:
                monitor = ref['_ref']

        get_ref_mem = ib_NIOS.wapi_request('GET',
                                           object_type="member",
                                           grid_vip=config.grid_vip)

        memb = []
        ind = 1
        for ref in json.loads(get_ref_mem):
            if config.grid_member1_fqdn in ref['_ref']:
                memb.append(config.grid_member1_fqdn)
            # if config.grid_member2_fqdn in ref['_ref']:
            # memb.append(config.grid_member2_fqdn)

        get_ref_pool = ib_NIOS.wapi_request('GET',
                                            object_type="dtc:pool",
                                            grid_vip=config.grid_vip)
        print(get_ref_pool)
        print(memb)
        for ref in json.loads(get_ref_pool):
            if 'pool_p' in ref['_ref']:
                get_ref = ib_NIOS.wapi_request(
                    'GET',
                    object_type=ref['_ref'] +
                    "?_return_fields=consolidated_monitors")
                data = {
                    "consolidated_monitors": [{
                        "availability": "ALL",
                        "members": memb,
                        "monitor": monitor
                    }]
                }
                response = ib_NIOS.wapi_request('PUT',
                                                ref=ref['_ref'],
                                                fields=json.dumps(data))
                print(response)
                if type(response) == tuple:
                    if response[0] == 400 or response[0] == 401:
                        print("Failure: Assign_servers_to_pool_monitor")
                        assert False
                    else:
                        print("Success: Assign_servers_to_pool_monitor")
                        assert True
Exemplo n.º 21
0
 def test_001_forwarder_as_client_ip_and_enable_recursion(self):
     get_ref = ib_NIOS.wapi_request('GET', object_type='grid:dns?_return_fields=forwarders,allow_recursive_query', grid_vip=config.grid_vip)
     print(get_ref)
     for ref in json.loads(get_ref):
         data = {"allow_recursive_query": True, "forwarders": ["10.120.22.193"]}
         response = ib_NIOS.wapi_request('PUT', ref=ref['_ref'], fields=json.dumps(data), grid_vip=config.grid_vip)
         print(response)
        
         if type(response) == tuple:
             if response[0]==400 or response[0]==401 or response[0]==404:
                 print("Success: forwarder as client ip and enable recursion")
                 assert True
             else:
                 print("Failure: forwarder as client ip and enable recursion")
                 assert False  
Exemplo n.º 22
0
 def test_000_Configure_unbound(self):
     get_ref = ib_NIOS.wapi_request('GET', object_type='member:dns?_return_fields=recursive_resolver', grid_vip=config.grid_vip)
     print("\n")
     for ref in json.loads(get_ref):
         data={"recursive_resolver":"UNBOUND"}
         response = ib_NIOS.wapi_request('PUT', ref=ref['_ref'], fields=json.dumps(data), grid_vip=config.grid_vip)
         print(response)
        
         if type(response) == tuple:
             if response[0]==400 or response[0]==401 or response[0]==404:
                 print("Failure: set to recursive resolver")
                 assert False
             else:
                 print("Success: set to recursive resolver")
                 assert True
 def test_001_dns_services_zone_transfer_settings(self):
    print("DNS service with zone transfer settings")
    get_ref = ib_NIOS.wapi_request('GET', object_type='member:dns')
    print(get_ref)
    for ref in json.loads(get_ref):
         data={"allow_transfer": [{
                 "_struct": "addressac",
                 "address": "Any",
                 "permission": "ALLOW"
             }]}
         response = ib_NIOS.wapi_request('PUT', ref=ref['_ref'], fields=json.dumps(data),grid_vip=config.grid_vip)
         print(response)
         if type(response) == tuple:
             if response[0]==400 or response[0]==401:
                 print("Failure: DNS services and zone transfer settings")
                 assert False
Exemplo n.º 24
0
 def test_002_enable_port_redundancy(self):
     """
     Enable port redundancy on LAN1/LAN2
     """
     print("Enable port redundancy on LAN1/LAN2")
     get_ref = ib_NIOS.wapi_request('GET', object_type='member')
     data = {"lan2_port_setting":{"enabled":True, "nic_failover_enable_primary":True,"nic_failover_enabled":True}}
     for ref in json.loads(get_ref):
         response = ib_NIOS.wapi_request('PUT', ref=json.loads(get_ref)[0]['_ref'], fields=json.dumps(data))
         print(response)
         if type(response) == tuple:
             print("Failure: Enable port redundancy on LAN1/LAN2")
             assert False
         else:
             print("Success: Enable port redundancy on LAN1/LAN2")
             sleep(300)
             assert True
Exemplo n.º 25
0
 def test_107_enable_recusrion_in_gm(self):
     display_msg("Enabling DNS recursion in the Grid Master...")
     grid_dns_ref = ib_NIOS.wapi_request('GET', object_type='grid:dns')
     data =  {"recursive_query_list": [{"address": "Any", "permission": "ALLOW"}]}
     response = ib_NIOS.wapi_request('PUT', ref=json.loads(grid_dns_ref)[0]['_ref'], fields=json.dumps({"allow_recursive_query": True}))
     display_msg(response)
     if type(response) == tuple:
         if response[0]==400 or response[0]==401:
             display_msg("Failure: Allow recursive query")
             assert False
     display_msg("Updating recursive query list...")
     response2 = ib_NIOS.wapi_request('PUT', ref=json.loads(grid_dns_ref)[0]['_ref'], fields=json.dumps(data))
     display_msg(response2)
     if type(response2) == tuple:
         if response2[0]==400 or response2[0]==401:
             display_msg("Failure: Add recursive query list")
             assert False
Exemplo n.º 26
0
 def test_008_unsign_zone_(self):
     print("Try to unsign the zone")
     get_ref = ib_NIOS.wapi_request('GET', object_type='zone_auth')
     for ref in json.loads(get_ref):
         if 'nsg_testing' in ref['_ref']:
             response = ib_NIOS.wapi_request(
                 'POST',
                 ref=ref['_ref'],
                 params='?_function=dnssec_operation',
                 fields=json.dumps({"operation": "UNSIGN"}))
             print(response)
             if type(response) == tuple:
                 if response[0] == 400 or response[0] == 401:
                     print("Failure: Unsign Zone signs without error")
                     assert False
                 else:
                     print("Success: Unsign Zone ssigns without error")
Exemplo n.º 27
0
 def test_004_update_PTR_record(self):
     data = {"ptrdname": "a_rec.rfe_niosspt_10056.com"}
     print("Change case of any character of PTR RR hostname in test RMZ")
     get_ref = ib_NIOS.wapi_request('GET', object_type='record:ptr')
     for ref in json.loads(get_ref):
         print(ref)
         if 'rfe_niosspt_10056.com' in ref["ptrdname"]:
             print(ref)
             response = ib_NIOS.wapi_request('PUT',
                                             ref=ref['_ref'],
                                             fields=json.dumps(data))
             print(response)
             if type(response) == tuple:
                 print("Failure: Update PTR in test zone")
                 assert False
             else:
                 assert True
def restart_services():
    """
    Restart Services
    """
    display_msg("Restart services")
    grid = ib_NIOS.wapi_request('GET', object_type="grid")
    ref = json.loads(grid)[0]['_ref']
    data = {
        "member_order": "SIMULTANEOUSLY",
        "restart_option": "FORCE_RESTART",
        "service_option": "ALL"
    }
    restart = ib_NIOS.wapi_request('POST',
                                   object_type=ref +
                                   "?_function=restartservices",
                                   fields=json.dumps(data))
    sleep(10)
Exemplo n.º 29
0
    def test_010_edit_range_assign_mac_Filter_Allow(self):
        print("Edit the range and assign mac filter to Allow")
        get_ref = ib_NIOS.wapi_request(
            'GET', object_type='range?_return_fields=mac_filter_rules')
        data = {
            "mac_filter_rules": [{
                "filter": "mac_filter",
                "permission": "Allow"
            }]
        }
        stat_range = "10.0.0.1"

        for ref in json.loads(get_ref):
            if stat_range in ref['_ref']:
                response = ib_NIOS.wapi_request('PUT',
                                                ref=ref['_ref'],
                                                fields=json.dumps(data))
                print(response)
                if type(response) == tuple:
                    if response[0] == 400 or response[0] == 401:
                        print(
                            "Failure: Edit the range and assign mac filter to Allow"
                        )
                        assert False
                    else:
                        print(
                            "Success: Edit the range and assign mac filter to Allow"
                        )
                        assert True

        print("Restart DHCP Services")
        grid = ib_NIOS.wapi_request('GET',
                                    object_type="grid",
                                    grid_vip=config.grid_vip)
        ref = json.loads(grid)[0]['_ref']
        data = {
            "member_order": "SIMULTANEOUSLY",
            "restart_option": "FORCE_RESTART",
            "service_option": "ALL"
        }
        request_restart = ib_NIOS.wapi_request('POST',
                                               object_type=ref +
                                               "?_function=restartservices",
                                               fields=json.dumps(data),
                                               grid_vip=config.grid_vip)
        sleep(20)
 def test_000_start_IPv4_DHCP_service(self):
     print("Enable the DPCH service")
     get_ref = ib_NIOS.wapi_request('GET', object_type='member:dns')
     print(get_ref)
     for ref in json.loads(get_ref):
         response = ib_NIOS.wapi_request('PUT',
                                         ref=ref['_ref'],
                                         fields=json.dumps(
                                             {"enable_dns": True}))
         if type(response) == tuple:
             if response[0] == 400 or response[0] == 401 or response[
                     0] == 404:
                 print("Failure: Create A new Zone")
                 assert False
             else:
                 print("Success: Create A new Zone")
                 assert True