import chi from chi import lease from chi import network from chi import server from chi.ssh import Remote PROJECT_NAME = 'SLATE' PROJECT_ID = 'CHI-210813' DEFAULT_SITE = 'CHI@TACC' # chi.use_site(DEFAULT_SITE) # chi.set("project_name", PROJECT_NAME) chi.set("image", "CC-CentOS8") chi.set("project_domain_id", "ba9774ff83e946689d066c501a2fd106") res = [] lease.add_node_reservation(res, node_type="compute_cascadelake_r", count=1) lease.add_fip_reservation(res, count=2) lease.add_network_reservation(res, network_name="chi-in-a-box-net") start_date, end_date = lease.lease_duration(days=7) l = lease.create_lease("chi-in-a-box-dev", res, start_date=start_date, end_date=end_date) l = lease.wait_for_active(l["id"]) # Create the node network port. This will be used to host # the CHI-in-a-Box API endpoints, amongst other things. # This is a bit complicated because we need to assign two # IP addresses to the instance on one interface.
def test_get(): value = "KEYNAME" chi.set("key_name", value) assert chi.get("key_name") == value
def test_reset(): value = "KEYNAME" chi.set("key_name", value) chi.reset() assert chi.get("key_name") == None
def test_session(): chi.set("auth_url", "AUTH_URL") chi.set("token", "TOKEN") chi.set("project_name", "PROJECT_NAME") chi.set("project_domain_name", "PROJECT_DOMAIN_NAME") chi.set("interface", "INTERFACE") chi.set("region_name", "REGION_NAME") session = chi.session() assert session auth_plugin = session.session.auth assert auth_plugin.auth_url == "AUTH_URL" assert auth_plugin.auth_methods[0].token == "TOKEN" assert auth_plugin.project_name == "PROJECT_NAME" assert auth_plugin.project_domain_name == "PROJECT_DOMAIN_NAME" assert session.interface == "INTERFACE" assert session.region_name == "REGION_NAME"
def test_set(): values = ["KEYNAME", "KEYNAME2"] [chi.set("key_name", k) for k in values] assert chi.get("key_name") == values[-1]