Change variable in vyos.py, add mocked data

This commit is contained in:
Pieprzycki Piotr 2016-12-21 13:49:40 +01:00
parent a63df96ade
commit 875ad85bd7
17 changed files with 561 additions and 81 deletions

View File

@ -51,7 +51,7 @@ class VyOSDriver(NetworkDriver):
self._username = username self._username = username
self._password = password self._password = password
self._timeout = timeout self._timeout = timeout
self._device = None self.device = None
self._scp_client = None self._scp_client = None
self._new_config = None self._new_config = None
self._old_config = None self._old_config = None
@ -91,19 +91,19 @@ class VyOSDriver(NetworkDriver):
self.port = optional_args.get('port', 22) self.port = optional_args.get('port', 22)
def open(self): def open(self):
self._device = ConnectHandler(device_type='vyos', self.device = ConnectHandler(device_type='vyos',
host=self._hostname, host=self._hostname,
username=self._username, username=self._username,
password=self._password, password=self._password,
**self.netmiko_optional_args) **self.netmiko_optional_args)
try: try:
self._scp_client = SCPConn(self._device) self._scp_client = SCPConn(self.device)
except: except:
raise ConnectionException("Failed to open connection ") raise ConnectionException("Failed to open connection ")
def close(self): def close(self):
self._device.disconnect() self.device.disconnect()
def load_replace_candidate(self, filename=None, config=None): def load_replace_candidate(self, filename=None, config=None):
""" """
@ -115,8 +115,8 @@ class VyOSDriver(NetworkDriver):
if filename is not None: if filename is not None:
if os.path.exists(filename) is True: if os.path.exists(filename) is True:
self._scp_client.scp_transfer_file(filename, self._DEST_FILENAME) self._scp_client.scp_transfer_file(filename, self._DEST_FILENAME)
self._device.send_command("cp "+self._BOOT_FILENAME+" "+self._BACKUP_FILENAME) self.device.send_command("cp "+self._BOOT_FILENAME+" "+self._BACKUP_FILENAME)
output_loadcmd = self._device.send_config_set(['load '+self._DEST_FILENAME]) output_loadcmd = self.device.send_config_set(['load '+self._DEST_FILENAME])
match_loaded = re.findall("Load complete.", output_loadcmd) match_loaded = re.findall("Load complete.", output_loadcmd)
match_notchanged = re.findall("No configuration changes to commit", output_loadcmd) match_notchanged = re.findall("No configuration changes to commit", output_loadcmd)
match_failed = re.findall("Failed to parse specified config file", output_loadcmd) match_failed = re.findall("Failed to parse specified config file", output_loadcmd)
@ -142,11 +142,11 @@ class VyOSDriver(NetworkDriver):
if filename is not None: if filename is not None:
if os.path.exists(filename) is True: if os.path.exists(filename) is True:
with open(filename) as f: with open(filename) as f:
self._device.send_command("cp "+self._BOOT_FILENAME+" " self.device.send_command("cp "+self._BOOT_FILENAME+" "
+ self._BACKUP_FILENAME) + self._BACKUP_FILENAME)
self._new_config = f.read() self._new_config = f.read()
cfg = [x for x in self._new_config.split("\n") if x is not ""] cfg = [x for x in self._new_config.split("\n") if x is not ""]
output_loadcmd = self._device.send_config_set(cfg) output_loadcmd = self.device.send_config_set(cfg)
match_setfailed = re.findall("Delete failed", output_loadcmd) match_setfailed = re.findall("Delete failed", output_loadcmd)
match_delfailed = re.findall("Set failed", output_loadcmd) match_delfailed = re.findall("Set failed", output_loadcmd)
@ -161,10 +161,10 @@ class VyOSDriver(NetworkDriver):
raise MergeConfigException("no configuration found") raise MergeConfigException("no configuration found")
def discard_config(self): def discard_config(self):
self._device.exit_config_mode() self.device.exit_config_mode()
def compare_config(self): def compare_config(self):
output_compare = self._device.send_config_set(['compare']) output_compare = self.device.send_config_set(['compare'])
match = re.findall("No changes between working and active configurations", match = re.findall("No changes between working and active configurations",
output_compare) output_compare)
if match: if match:
@ -174,22 +174,22 @@ class VyOSDriver(NetworkDriver):
return diff return diff
def commit_config(self): def commit_config(self):
if self._device.commit(): if self.device.commit():
self._device.send_config_set(['save']) self.device.send_config_set(['save'])
self._device.exit_config_mode() self.device.exit_config_mode()
def rollback(self, filename=None): def rollback(self, filename=None):
"""Rollback configuration to filename or to self.rollback_cfg file.""" """Rollback configuration to filename or to self.rollback_cfg file."""
if filename is None: if filename is None:
filename = self._BACKUP_FILENAME filename = self._BACKUP_FILENAME
output_loadcmd = self._device.send_config_set(['load '+filename]) output_loadcmd = self.device.send_config_set(['load '+filename])
match = re.findall("Load complete.", output_loadcmd) match = re.findall("Load complete.", output_loadcmd)
if not match: if not match:
raise ReplaceConfigException("Failed rollback config: " raise ReplaceConfigException("Failed rollback config: "
+ output_loadcmd) + output_loadcmd)
else: else:
self._device.send_config_set(['commit', 'save']) self.device.send_config_set(['commit', 'save'])
def get_environment(self): def get_environment(self):
""" """
@ -199,7 +199,7 @@ class VyOSDriver(NetworkDriver):
0 0 0 61404 139624 139360 0 0 0 0 9 14 0 0 100 0 0 0 0 61404 139624 139360 0 0 0 0 9 14 0 0 100 0
""" """
output_cpu_list = list() output_cpu_list = list()
output_cpu = self._device.send_command("vmstat") output_cpu = self.device.send_command("vmstat")
output_cpu = str(output_cpu) output_cpu = str(output_cpu)
output_cpu_list = output_cpu.split("\n") output_cpu_list = output_cpu.split("\n")
if len(output_cpu_list[-1]) > 0: if len(output_cpu_list[-1]) > 0:
@ -216,7 +216,7 @@ class VyOSDriver(NetworkDriver):
-/+ buffers/cache: 167800 340356 -/+ buffers/cache: 167800 340356
Swap: 0 0 0 Swap: 0 0 0
""" """
output_ram = self._device.send_command("free").split("\n")[1] output_ram = self.device.send_command("free").split("\n")[1]
available_ram, used_ram = output_ram.split()[1:3] available_ram, used_ram = output_ram.split()[1:3]
environment = { environment = {
@ -265,7 +265,7 @@ class VyOSDriver(NetworkDriver):
lo 127.0.0.1/8 u/u lo 127.0.0.1/8 u/u
::1/128 ::1/128
""" """
output_iface = self._device.send_command("show interfaces") output_iface = self.device.send_command("show interfaces")
# Collect all interfaces' name and status # Collect all interfaces' name and status
match = re.findall("(\S+)\s+[:\-\d/\.]+\s+([uAD])/([uAD])", output_iface) match = re.findall("(\S+)\s+[:\-\d/\.]+\s+([uAD])/([uAD])", output_iface)
@ -275,7 +275,7 @@ class VyOSDriver(NetworkDriver):
iface_state = {iface_name: {"State": state, "Link": link} for iface_name, iface_state = {iface_name: {"State": state, "Link": link} for iface_name,
state, link in match} state, link in match}
output_conf = self._device.send_command("show configuration") output_conf = self.device.send_command("show configuration")
# Convert the configuration to dictionary # Convert the configuration to dictionary
config = vyattaconfparser.parse_conf(output_conf) config = vyattaconfparser.parse_conf(output_conf)
@ -334,7 +334,7 @@ class VyOSDriver(NetworkDriver):
10.129.2.97 ether 00:50:56:9f:64:09 C eth0 10.129.2.97 ether 00:50:56:9f:64:09 C eth0
192.168.1.3 ether 00:50:56:86:7b:06 C eth1 192.168.1.3 ether 00:50:56:86:7b:06 C eth1
""" """
output = self._device.send_command("show arp") output = self.device.send_command("show arp")
output = output.split("\n") output = output.split("\n")
# Skip the header line # Skip the header line
@ -373,7 +373,7 @@ class VyOSDriver(NetworkDriver):
133.130.120.204 133.243.238.164 2 u 46 64 377 7.717 987996. 1669.77 133.130.120.204 133.243.238.164 2 u 46 64 377 7.717 987996. 1669.77
""" """
output = self._device.send_command("ntpq -np") output = self.device.send_command("ntpq -np")
output = output.split("\n")[2:] output = output.split("\n")[2:]
ntp_stats = list() ntp_stats = list()
@ -407,7 +407,7 @@ class VyOSDriver(NetworkDriver):
return ntp_stats return ntp_stats
def get_ntp_peers(self): def get_ntp_peers(self):
output = self._device.send_command("ntpq -np") output = self.device.send_command("ntpq -np")
output_peers = output.split("\n")[2:] output_peers = output.split("\n")[2:]
ntp_peers = dict() ntp_peers = dict()
@ -436,7 +436,7 @@ class VyOSDriver(NetworkDriver):
192.168.1.4 4 64522 0 0 0 0 0 never Active 192.168.1.4 4 64522 0 0 0 0 0 never Active
""" """
output = self._device.send_command("show ip bgp summary") output = self.device.send_command("show ip bgp summary")
output = output.split("\n") output = output.split("\n")
match = re.search(".* router identifier (\d+\.\d+\.\d+\.\d+), local AS number (\d+)", match = re.search(".* router identifier (\d+\.\d+\.\d+\.\d+), local AS number (\d+)",
@ -487,7 +487,7 @@ class VyOSDriver(NetworkDriver):
1 accepted prefixes 1 accepted prefixes
~~~ ~~~
""" """
bgp_detail = self._device.send_command("show ip bgp neighbors %s" % peer_id) bgp_detail = self.device.send_command("show ip bgp neighbors %s" % peer_id)
match_rid = re.search("remote router ID (\d+\.\d+\.\d+\.\d+).*", bgp_detail) match_rid = re.search("remote router ID (\d+\.\d+\.\d+\.\d+).*", bgp_detail)
remote_rid = match_rid.group(1) remote_rid = match_rid.group(1)
@ -563,7 +563,7 @@ class VyOSDriver(NetworkDriver):
TX: bytes packets errors dropped carrier collisions TX: bytes packets errors dropped carrier collisions
32776498 279273 0 0 0 0 32776498 279273 0 0 0 0
""" """
output = self._device.send_command("show interfaces detail") output = self.device.send_command("show interfaces detail")
interfaces = re.findall("(\S+): <.*", output) interfaces = re.findall("(\S+): <.*", output)
# count = re.findall("(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+", output) # count = re.findall("(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+", output)
count = re.findall("(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)", output) count = re.findall("(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)", output)
@ -603,7 +603,7 @@ class VyOSDriver(NetworkDriver):
def get_snmp_information(self): def get_snmp_information(self):
# 'acl' is not implemented yet # 'acl' is not implemented yet
output = self._device.send_command("show configuration") output = self.device.send_command("show configuration")
# convert the configuration to dictionary # convert the configuration to dictionary
config = vyattaconfparser.parse_conf(output) config = vyattaconfparser.parse_conf(output)
@ -630,11 +630,11 @@ class VyOSDriver(NetworkDriver):
return {} return {}
def get_facts(self): def get_facts(self):
output_uptime = self._device.send_command("cat /proc/uptime | awk '{print $1}'") output_uptime = self.device.send_command("cat /proc/uptime | awk '{print $1}'")
uptime = int(float(output_uptime)) uptime = int(float(output_uptime))
output = self._device.send_command("show version").split("\n") output = self.device.send_command("show version").split("\n")
ver_str = [line for line in output if "Version" in line][0] ver_str = [line for line in output if "Version" in line][0]
version = self.parse_version(ver_str) version = self.parse_version(ver_str)
@ -644,7 +644,7 @@ class VyOSDriver(NetworkDriver):
hwmodel_str = [line for line in output if "HW model" in line][0] hwmodel_str = [line for line in output if "HW model" in line][0]
hwmodel = self.parse_hwmodel(hwmodel_str) hwmodel = self.parse_hwmodel(hwmodel_str)
output = self._device.send_command("show configuration") output = self.device.send_command("show configuration")
config = vyattaconfparser.parse_conf(output) config = vyattaconfparser.parse_conf(output)
if "host-name" in config["system"]: if "host-name" in config["system"]:
@ -691,7 +691,7 @@ class VyOSDriver(NetworkDriver):
return model[1].strip() return model[1].strip()
def get_interfaces_ip(self): def get_interfaces_ip(self):
output = self._device.send_command("show interfaces") output = self.device.send_command("show interfaces")
output = output.split("\n") output = output.split("\n")
# delete the header line and the interfaces which has no ip address # delete the header line and the interfaces which has no ip address
@ -732,7 +732,7 @@ class VyOSDriver(NetworkDriver):
return "ipv4" return "ipv4"
def get_users(self): def get_users(self):
output = self._device.send_command("show configuration commands").split("\n") output = self.device.send_command("show configuration commands").split("\n")
user_conf = [x.split() for x in output if "login user" in x] user_conf = [x.split() for x in output if "login user" in x]
@ -785,7 +785,7 @@ class VyOSDriver(NetworkDriver):
command += "interface %s " % source command += "interface %s " % source
ping_result = dict() ping_result = dict()
output_ping = self._device.send_command(command) output_ping = self.device.send_command(command)
if "Unknown host" in output_ping: if "Unknown host" in output_ping:
err = "Unknown host" err = "Unknown host"

View File

@ -37,7 +37,7 @@ class PatchedVyOSDriver(vyos.VyOSDriver):
self.patched_attrs = ['device'] self.patched_attrs = ['device']
self.device = FakeVyOSDevice() self.device = FakeVyOSDevice()
self._device = FakeVyOSDevice() #self._device = FakeVyOSDevice()
def close(self): def close(self):
pass pass
@ -54,8 +54,11 @@ class PatchedVyOSDriver(vyos.VyOSDriver):
class FakeVyOSDevice(BaseTestDouble): class FakeVyOSDevice(BaseTestDouble):
"""VyOS device test double.""" """VyOS device test double."""
def send_command(self, command, **kwargs): def send_command(self, command, **kwargs):
filename = '{}.text'.format(self.sanitize_text(command)) filename = '{}.text'.format(self.sanitize_text(command))
print filename
full_path = self.find_file(filename) full_path = self.find_file(filename)
result = self.read_txt_file(full_path) result = self.read_txt_file(full_path)
return py23_compat.text_type(result) return py23_compat.text_type(result)

View File

@ -1,5 +1,4 @@
Address HWtype HWaddress Flags Mask Iface Address HWtype HWaddress Flags Mask Iface
10.0.12.33 (incomplete) eth1
10.0.12.1 ether 08:00:27:60:0f:ee C eth1
10.0.2.2 ether 52:54:00:12:35:02 C eth0
10.0.2.3 ether 52:54:00:12:35:03 C eth0 10.0.2.3 ether 52:54:00:12:35:03 C eth0
10.0.1.100 ether 08:00:27:27:03:8e C eth1
10.0.2.2 ether 52:54:00:12:35:02 C eth0

View File

@ -1,43 +0,0 @@
BGP neighbor is 10.0.12.1, remote AS 65001, local AS 65002, external link
BGP version 4, remote router ID 10.1.1.1
BGP state = Established, up for 01w3d00h
Last read 03:39:29, hold time is 90, keepalive interval is 30 seconds
Neighbor capabilities:
4 Byte AS: advertised and received
Route refresh: advertised and received(old & new)
Address family IPv4 Unicast: advertised and received
Graceful Restart Capabilty: received
Remote Restart timer is 120 seconds
Address families by peer:
none
Graceful restart informations:
End-of-RIB send: IPv4 Unicast
End-of-RIB received:
Message statistics:
Inq depth is 0
Outq depth is 0
Sent Rcvd
Opens: 2 2
Notifications: 1 0
Updates: 4 2
Keepalives: 33375 36937
Route Refresh: 0 0
Capability: 0 0
Total: 33382 36941
Minimum time between advertisement runs is 30 seconds
For address family: IPv4 Unicast
Community attribute sent to this neighbor(both)
Outbound path policy configured
Route map for outgoing advertisements is *EXPORT-POLICY
4 accepted prefixes
Connections established 2; dropped 1
Last reset 01w3d00h, due to User reset
Local host: 10.0.12.2, Local port: 33945
Foreign host: 10.0.12.1, Foreign port: 179
Nexthop: 10.0.12.2
Nexthop global: fe80::a00:27ff:fe41:d5f8
Nexthop local: ::
BGP connection: non shared network
Read thread: on Write thread: off

View File

@ -0,0 +1,36 @@
BGP neighbor is 10.0.1.100, remote AS 65001, local AS 65002, external link
BGP version 4, remote router ID 10.0.2.100
BGP state = Established, up for 03w0d00h
Last read 11:37:17, hold time is 180, keepalive interval is 60 seconds
Neighbor capabilities:
4 Byte AS: advertised and received
Route refresh: advertised and received(old & new)
Address family IPv4 Unicast: advertised and received
Message statistics:
Inq depth is 0
Outq depth is 0
Sent Rcvd
Opens: 2 0
Notifications: 0 0
Updates: 1 0
Keepalives: 30257 30255
Route Refresh: 0 0
Capability: 0 0
Total: 30260 30255
Minimum time between advertisement runs is 30 seconds
For address family: IPv4 Unicast
Community attribute sent to this neighbor(both)
Outbound path policy configured
Route map for outgoing advertisements is *EXPORT-POLICY
0 accepted prefixes
Connections established 1; dropped 0
Last reset never
Local host: 10.0.1.222, Local port: 179
Foreign host: 10.0.1.100, Foreign port: 44363
Nexthop: 10.0.1.222
Nexthop global: fe80::a00:27ff:feeb:7af9
Nexthop local: ::
BGP connection: non shared network
Read thread: on Write thread: off

View File

@ -1,9 +1,9 @@
BGP router identifier 10.2.2.2, local AS number 65002 BGP router identifier 10.2.2.2, local AS number 65002
IPv4 Unicast - max multipaths: ebgp 1 ibgp 1 IPv4 Unicast - max multipaths: ebgp 1 ibgp 1
RIB entries 9, using 864 bytes of memory RIB entries 1, using 96 bytes of memory
Peers 1, using 4560 bytes of memory Peers 1, using 4560 bytes of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.0.12.1 4 65001 36938 33380 0 0 0 01w3d00h 4 10.0.1.100 4 65001 30254 30259 0 0 0 03w0d00h 0
Total number of neighbors 1 Total number of neighbors 1

View File

@ -0,0 +1,124 @@
interfaces {
ethernet eth0 {
address dhcp
duplex auto
smp_affinity auto
speed auto
}
ethernet eth1 {
address 10.0.1.222/24
duplex auto
smp_affinity auto
speed auto
}
loopback lo {
address 10.2.2.2/32
address 8.8.8.8/32
}
}
policy {
prefix-list EXPORT {
rule 1 {
action permit
prefix 172.16.2.0/24
}
rule 65535 {
action permit
prefix 10.2.2.2/32
}
}
route-map EXPORT-POLICY {
rule 1 {
action permit
match {
ip {
address {
prefix-list EXPORT
}
}
}
}
}
}
protocols {
bgp 65002 {
neighbor 10.0.1.100 {
remote-as 65001
route-map {
export EXPORT-POLICY
}
}
redistribute {
connected {
route-map EXPORT-POLICY
}
}
}
}
service {
snmp {
community commro {
authorization ro
}
contact admin@foo.corp
location PL,Krakow
}
ssh {
disable-host-validation
port 22
}
}
system {
config-management {
commit-revisions 20
}
host-name vyos2
login {
banner {
pre-login "My banner for all devices"
}
user vagrant {
authentication {
encrypted-password $6$fcHhBu3T$WLmiu6/txlEfWK5uh4mKE8v7qocuftsoAN1oHqPIIoogXAX8zS.SKhB105EExYU6yBy4cKHUD/Q6Mm7CUbVTr.
plaintext-password ""
public-keys vagrant {
key AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ==
type ssh-rsa
}
}
level admin
}
user vyos {
authentication {
encrypted-password $1$yHIMnG/J$aWDkd3oDYSYps8twB5vpw1
plaintext-password ""
}
level admin
}
}
ntp {
server 10.0.1.100 {
}
}
package {
auto-sync 1
repository community {
components main
distribution helium
password ""
url http://packages.vyos.net/vyos
username ""
}
}
syslog {
global {
facility all {
level notice
}
facility protocols {
level debug
}
}
}
time-zone UTC
}

View File

@ -0,0 +1,13 @@
Version: VyOS 1.1.7
Description: VyOS 1.1.7 (helium)
Copyright: 2016 VyOS maintainers and contributors
Built by: maintainers@vyos.net
Built on: Wed Feb 17 09:57:31 UTC 2016
Build ID: 1602170957-4459750
System type: x86 64-bit
Boot via: image
Hypervisor: VMware
HW model: VirtualBox
HW S/N: 0
HW UUID: 9728B94A-52FA-4C1A-AC83-7C6CA76F6F13
Uptime: 12:44:18 up 21 days, 20 min, 1 user, load average: 0.00, 0.01, 0.05

View File

@ -0,0 +1,124 @@
interfaces {
ethernet eth0 {
address dhcp
duplex auto
smp_affinity auto
speed auto
}
ethernet eth1 {
address 10.0.1.222/24
duplex auto
smp_affinity auto
speed auto
}
loopback lo {
address 10.2.2.2/32
address 8.8.8.8/32
}
}
policy {
prefix-list EXPORT {
rule 1 {
action permit
prefix 172.16.2.0/24
}
rule 65535 {
action permit
prefix 10.2.2.2/32
}
}
route-map EXPORT-POLICY {
rule 1 {
action permit
match {
ip {
address {
prefix-list EXPORT
}
}
}
}
}
}
protocols {
bgp 65002 {
neighbor 10.0.1.100 {
remote-as 65001
route-map {
export EXPORT-POLICY
}
}
redistribute {
connected {
route-map EXPORT-POLICY
}
}
}
}
service {
snmp {
community commro {
authorization ro
}
contact admin@foo.corp
location PL,Krakow
}
ssh {
disable-host-validation
port 22
}
}
system {
config-management {
commit-revisions 20
}
host-name vyos2
login {
banner {
pre-login "My banner for all devices"
}
user vagrant {
authentication {
encrypted-password $6$fcHhBu3T$WLmiu6/txlEfWK5uh4mKE8v7qocuftsoAN1oHqPIIoogXAX8zS.SKhB105EExYU6yBy4cKHUD/Q6Mm7CUbVTr.
plaintext-password ""
public-keys vagrant {
key AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ==
type ssh-rsa
}
}
level admin
}
user vyos {
authentication {
encrypted-password $1$yHIMnG/J$aWDkd3oDYSYps8twB5vpw1
plaintext-password ""
}
level admin
}
}
ntp {
server 10.0.1.100 {
}
}
package {
auto-sync 1
repository community {
components main
distribution helium
password ""
url http://packages.vyos.net/vyos
username ""
}
}
syslog {
global {
facility all {
level notice
}
facility protocols {
level debug
}
}
}
time-zone UTC
}

View File

@ -0,0 +1,44 @@
eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:0f:ec:bf brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fe0f:ecbf/64 scope link
valid_lft forever preferred_lft forever
RX: bytes packets errors dropped overrun mcast
1307723 13601 0 0 0 0
TX: bytes packets errors dropped carrier collisions
2199213 9708 0 0 0 0
eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:eb:7a:f9 brd ff:ff:ff:ff:ff:ff
inet 10.0.1.222/24 brd 10.0.1.255 scope global eth1
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:feeb:7af9/64 scope link
valid_lft forever preferred_lft forever
RX: bytes packets errors dropped overrun mcast
7009338 96514 0 0 0 0
TX: bytes packets errors dropped carrier collisions
7072471 97453 0 0 0 0
eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 08:00:27:b9:f5:4a brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast
0 0 0 0 0 0
TX: bytes packets errors dropped carrier collisions
818 7 0 0 0 0
lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet 10.2.2.2/32 scope global lo
valid_lft forever preferred_lft forever
inet 8.8.8.8/32 scope global lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
RX: bytes packets errors dropped overrun mcast
198185 2394 0 0 0 0
TX: bytes packets errors dropped carrier collisions
198185 2394 0 0 0 0

View File

@ -0,0 +1,10 @@
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface IP Address S/L Description
--------- ---------- --- -----------
eth0 10.0.2.15/24 u/u
eth1 10.0.1.222/24 u/u
eth2 - A/D
lo 127.0.0.1/8 u/u
10.2.2.2/32
8.8.8.8/32
::1/128

View File

@ -0,0 +1,3 @@
remote refid st t when poll reach delay offset jitter
==============================================================================
10.0.1.100 .INIT. 16 u 301 1024 0 0.000 0.000 0.000

View File

@ -0,0 +1,3 @@
remote refid st t when poll reach delay offset jitter
==============================================================================
10.0.1.100 .INIT. 16 u 301 1024 0 0.000 0.000 0.000

View File

@ -0,0 +1,124 @@
interfaces {
ethernet eth0 {
address dhcp
duplex auto
smp_affinity auto
speed auto
}
ethernet eth1 {
address 10.0.1.222/24
duplex auto
smp_affinity auto
speed auto
}
loopback lo {
address 10.2.2.2/32
address 8.8.8.8/32
}
}
policy {
prefix-list EXPORT {
rule 1 {
action permit
prefix 172.16.2.0/24
}
rule 65535 {
action permit
prefix 10.2.2.2/32
}
}
route-map EXPORT-POLICY {
rule 1 {
action permit
match {
ip {
address {
prefix-list EXPORT
}
}
}
}
}
}
protocols {
bgp 65002 {
neighbor 10.0.1.100 {
remote-as 65001
route-map {
export EXPORT-POLICY
}
}
redistribute {
connected {
route-map EXPORT-POLICY
}
}
}
}
service {
snmp {
community commro {
authorization ro
}
contact admin@foo.corp
location PL,Krakow
}
ssh {
disable-host-validation
port 22
}
}
system {
config-management {
commit-revisions 20
}
host-name vyos2
login {
banner {
pre-login "My banner for all devices"
}
user vagrant {
authentication {
encrypted-password $6$fcHhBu3T$WLmiu6/txlEfWK5uh4mKE8v7qocuftsoAN1oHqPIIoogXAX8zS.SKhB105EExYU6yBy4cKHUD/Q6Mm7CUbVTr.
plaintext-password ""
public-keys vagrant {
key AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ==
type ssh-rsa
}
}
level admin
}
user vyos {
authentication {
encrypted-password $1$yHIMnG/J$aWDkd3oDYSYps8twB5vpw1
plaintext-password ""
}
level admin
}
}
ntp {
server 10.0.1.100 {
}
}
package {
auto-sync 1
repository community {
components main
distribution helium
password ""
url http://packages.vyos.net/vyos
username ""
}
}
syslog {
global {
facility all {
level notice
}
facility protocols {
level debug
}
}
}
time-zone UTC
}

View File

@ -0,0 +1,39 @@
set interfaces ethernet eth0 address 'dhcp'
set interfaces ethernet eth1 address '10.0.1.222/24'
set interfaces loopback lo address '10.2.2.2/32'
set interfaces loopback lo address '8.8.8.8/32'
set policy prefix-list EXPORT rule 1 action 'permit'
set policy prefix-list EXPORT rule 1 prefix '172.16.2.0/24'
set policy prefix-list EXPORT rule 65535 action 'permit'
set policy prefix-list EXPORT rule 65535 prefix '10.2.2.2/32'
set policy route-map EXPORT-POLICY rule 1 action 'permit'
set policy route-map EXPORT-POLICY rule 1 match ip address prefix-list 'EXPORT'
set protocols bgp 65002 neighbor 10.0.1.100 remote-as '65001'
set protocols bgp 65002 neighbor 10.0.1.100 route-map export 'EXPORT-POLICY'
set protocols bgp 65002 redistribute connected route-map 'EXPORT-POLICY'
set service snmp community commro authorization 'ro'
set service snmp contact 'admin@foo.corp'
set service snmp location 'PL,Krakow'
set service ssh 'disable-host-validation'
set service ssh port '22'
set system config-management commit-revisions '20'
set system host-name 'vyos2'
set system login banner pre-login 'My banner for all devices'
set system login user vagrant authentication encrypted-password '$6$fcHhBu3T$WLmiu6/txlEfWK5uh4mKE8v7qocuftsoAN1oHqPIIoogXAX8zS.SKhB105EExYU6yBy4cKHUD/Q6Mm7CUbVTr.'
set system login user vagrant authentication plaintext-password ''
set system login user vagrant authentication public-keys vagrant key 'AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ=='
set system login user vagrant authentication public-keys vagrant type 'ssh-rsa'
set system login user vagrant level 'admin'
set system login user vyos authentication encrypted-password '$1$yHIMnG/J$aWDkd3oDYSYps8twB5vpw1'
set system login user vyos authentication plaintext-password ''
set system login user vyos level 'admin'
set system ntp server '10.0.1.100'
set system package auto-sync '1'
set system package repository community components 'main'
set system package repository community distribution 'helium'
set system package repository community password ''
set system package repository community url 'http://packages.vyos.net/vyos'
set system package repository community username ''
set system syslog global facility all level 'notice'
set system syslog global facility protocols level 'debug'
set system time-zone 'UTC'