forked from akarneliuk/pygnmi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_address_types.py
87 lines (62 loc) · 2.43 KB
/
test_address_types.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env python
# Modules
from pygnmi.client import gNMIclient
from dotenv import load_dotenv
import os
# User-defined functions (Tests)
def test_fqdn_address():
load_dotenv()
username_str = os.getenv("PYGNMI_USER")
password_str = os.getenv("PYGNMI_PASS")
hostname_str = os.getenv("PYGNMI_HOST")
port_str = os.getenv("PYGNMI_PORT")
path_cert_str = os.getenv("PYGNMI_CERT")
gc = gNMIclient(target=(hostname_str, port_str), username=username_str, password=password_str, path_cert=path_cert_str)
gc.connect()
result = gc.capabilities()
gc.close()
assert "supported_models" in result
assert "supported_encodings" in result
assert "gnmi_version" in result
def test_ipv4_address_override():
load_dotenv()
username_str = os.getenv("PYGNMI_USER")
password_str = os.getenv("PYGNMI_PASS")
hostname_str = os.getenv("PYGNMI_HOST_2")
port_str = os.getenv("PYGNMI_PORT")
path_cert_str = os.getenv("PYGNMI_CERT")
gc = gNMIclient(target=(hostname_str, port_str), username=username_str, password=password_str, path_cert=path_cert_str, override="EOS425")
gc.connect()
result = gc.capabilities()
gc.close()
assert "supported_models" in result
assert "supported_encodings" in result
assert "gnmi_version" in result
def test_ipv4_address_certificate_download():
load_dotenv()
username_str = os.getenv("PYGNMI_USER")
password_str = os.getenv("PYGNMI_PASS")
hostname_str = os.getenv("PYGNMI_HOST_2")
port_str = os.getenv("PYGNMI_PORT")
path_cert_str = os.getenv("PYGNMI_CERT")
gc = gNMIclient(target=(hostname_str, port_str), username=username_str, password=password_str)
gc.connect()
result = gc.capabilities()
gc.close()
assert "supported_models" in result
assert "supported_encodings" in result
assert "gnmi_version" in result
def test_ipv6_address_override():
load_dotenv()
username_str = os.getenv("PYGNMI_USER")
password_str = os.getenv("PYGNMI_PASS")
hostname_str = os.getenv("PYGNMI_HOST_3")
port_str = os.getenv("PYGNMI_PORT")
path_cert_str = os.getenv("PYGNMI_CERT")
gc = gNMIclient(target=(hostname_str, port_str), username=username_str, password=password_str, path_cert=path_cert_str, override="EOS425")
gc.connect()
result = gc.capabilities()
gc.close()
assert "supported_models" in result
assert "supported_encodings" in result
assert "gnmi_version" in result