-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_pytestDeploy.py
54 lines (45 loc) · 2.14 KB
/
test_pytestDeploy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/python3
# python3.8.4
# inputs: everything
# dependencies: all
# created 11-may-2021
import pytest
import requests
requests.packages.urllib3.disable_warnings()
from classes.version_521g import *
from classes.version_521g.var import *
import json
@pytest.fixture(scope='session', autouse=True)
def get_cookies():
url = apic + '/api/aaaLogin.json'
auth = {'aaaUser': {'attributes': {'name': username, 'pwd': password}}}
authenticate = requests.post(url, data=json.dumps(auth), verify=False)
return authenticate.cookies
def test_createSnapshot(get_cookies):
data = snapshot.Snapshot(apic, ref_id)
push = requests.post(data, data=json.dumps(data.payload), verify=False, cookies=get_cookies)
assert push.status_code == 200
def test_deployTenant(get_cookies):
data = tenant.Tenant(apic, tenant_id, descr_id)
push = requests.post(data, data=json.dumps(data.payload), verify=False, cookies=get_cookies)
assert push.status_code == 200
def test_deployVrf(get_cookies):
data = vrf.Vrf(apic, tenant_id, vrf_id, descr_id)
push = requests.post(data, data=json.dumps(data.payload), verify=False, cookies=get_cookies)
assert push.status_code == 200
def test_readTenant(get_cookies):
data = tenant.Tenant(apic, tenant_id, descr_id)
push = requests.post(data, data=json.dumps(data.payload), verify=False, cookies=get_cookies)
assert push.status_code == 200
def test_readVrf(get_cookies):
data = vrf.Vrf(apic, tenant_id, vrf_id, descr_id)
push = requests.post(data, data=json.dumps(data.payload), verify=False, cookies=get_cookies)
assert push.status_code == 200
def test_deployBridge_domain(get_cookies):
data = bridge_domain.Bridge_domain(apic, tenant_id, bridge_domain_id, subnet_a, vrf_id, descr_id)
push = requests.post(data, data=json.dumps(data.payload), verify=False, cookies=get_cookies)
assert push.status_code == 200
def test_deployBridge_domain(get_cookies):
data = vlan_pool.Vlan_pool(apic, vlan_pool_id, vlan_range_start, vlan_range_finish, descr_id)
push = requests.post(data, data=json.dumps(data.payload), verify=False, cookies=get_cookies)
assert push.status_code == 200