def test_ntp_servers_clear_all_disabled(): ntp_servers_clear(handle) match, mo = ntp_setting_exists(handle, ntp_enable="no", ntp_servers=[{"id": 1, "ip": ""}, {"id": 2, "ip": ""}, {"id": 3, "ip": ""}, {"id": 4, "ip": ""}])
def test_ntp_servers_clear(): ntp_servers_clear(handle, ntp_servers=["192.168.1.3", "1.1.1.1"]) match, mo = ntp_setting_exists(handle, ntp_enable="yes", ntp_servers=[{ "id": 1, "ip": "192.168.1.1" }]) assert_equal(match, True)
def setup(server, module): from imcsdk.apis.admin.ntp import ntp_enable from imcsdk.apis.admin.ntp import ntp_disable from imcsdk.apis.admin.ntp import ntp_setting_exists results = {} err = False try: ansible = module.params if ansible['state'] == 'present': ntp_servers = ansible['ntp_servers'] exists, mo = ntp_setting_exists(server, ntp_enable='yes', ntp_servers=ansible['ntp_servers']) if module.check_mode or exists: results["changed"] = not exists return results, False ntp_enable(server, ntp_servers=ntp_servers) elif ansible['state'] == 'absent': exists, mo = ntp_setting_exists(server, ntp_enable='no') if module.check_mode or exists: results["changed"] = not exists return results, False ntp_disable(server) results['changed'] = True except Exception as e: err = True results["msg"] = str(e) results["changed"] = False return results, err
def test_ntp_servers_clear_all_disabled(): ntp_servers_clear(handle) match, mo = ntp_setting_exists(handle, ntp_enable="no", ntp_servers=[{ "id": 1, "ip": "" }, { "id": 2, "ip": "" }, { "id": 3, "ip": "" }, { "id": 4, "ip": "" }])
def test_ntp_servers_clear(): ntp_servers_clear(handle, ntp_servers=["192.168.1.3", "1.1.1.1"]) match, mo = ntp_setting_exists(handle, ntp_enable="yes", ntp_servers=[{"id": 1, "ip": "192.168.1.1"}]) assert_equal(match, True)
def test_ntp_servers_modify(): ntp_servers_modify(handle, ntp_servers=ntp_servers_3) match, mo = ntp_setting_exists(handle, ntp_enable="yes", ntp_servers=ntp_servers_3) assert_equal(match, True)
def test_ntp_setting_exists_3(): match, mo = ntp_setting_exists(handle, ntp_enable="yes") assert_equal(match, True)
def test_ntp_enable_2(): ntp_enable(handle, ntp_servers=ntp_servers_2) match, mo = ntp_setting_exists(handle, ntp_servers=ntp_servers_2) assert_equal(match, True)
def test_ntp_setting_exists_2(): match, mo = ntp_setting_exists(handle, ntp_enable="yes", ntp_servers=ntp_servers_2) assert_equal(match, True)