Original Message:
Sent: 02-06-2025 01:42
From: alin_bandiu
Subject: vRouter Corrupted all the time in Eve-NG, Seems more unstable that the older vMX
I get around this using a Python script within Eve, basically, this shuts down every Vjunos node in the specified lab. However, I prefer to use the old vcp/vfp
import requests
import json
import urllib.parse
import warnings
import telnetlib
from concurrent.futures import ThreadPoolExecutor
# Suppress only the single InsecureRequestWarning from urllib3
from requests.packages.urllib3.exceptions import InsecureRequestWarning
warnings.simplefilter('ignore', InsecureRequestWarning)
# Define base URL and credentials
base_url = "eve-url"
username = "user"
password = "password"
# Function to authenticate and get cookies
def login(base_url, username, password):
session = requests.Session() # Create a session
response = session.post(f"{base_url}/api/auth/login",
json={"username": username, "password": password, "html5": "0"},
verify=False)
if response.status_code == 200 and response.json().get("code") == 200:
print("Logged in successfully.")
return session # Return the session with cookies
else:
print("Login failed.")
return None
# Function to get available folders
def get_folders(session, base_url):
response = session.get(f"{base_url}/api/folders/", verify=False)
return response.json()
# Function to get labs in a specific folder
def get_labs_in_folder(session, base_url, folder_path):
response = session.get(f"{base_url}/api/folders{folder_path}", verify=False)
return response.json()
# Function to get nodes in a specific lab
def get_nodes_in_lab(session, base_url, lab_path):
# URL encode the lab path
lab_path_encoded = urllib.parse.quote(lab_path)
response = session.get(f"{base_url}/api/labs{lab_path_encoded}/nodes", verify=False)
return response.json()
# Main script for powering off vjunosrouter devices
session = login(base_url, username, password)
if session is None:
exit()
# Get available folders
folders_response = get_folders(session, base_url)
if folders_response.get("code") == 200:
folders = folders_response.get("data", {}).get("folders", [])
print("\nAvailable Folders:")
for index, folder in enumerate(folders):
print(f"{index + 1}. {folder['name']} (Path: {folder['path']})")
folder_index = int(input("\nSelect a folder by number: ")) - 1
selected_folder = folders[folder_index]['path']
# Get labs in the selected folder
labs_response = get_labs_in_folder(session, base_url, selected_folder)
if labs_response.get("code") == 200:
labs = labs_response.get("data", {}).get("labs", [])
print(f"\nAvailable Labs in '{selected_folder}':")
for index, lab in enumerate(labs):
print(f"{index + 1}. {lab['file']} (Path: {lab['path']})")
lab_index = int(input("\nSelect a lab by number: ")) - 1
selected_lab = labs[lab_index]['path'] # Use 'path' to get the lab's path
# Get nodes in the selected lab
nodes_response = get_nodes_in_lab(session, base_url, selected_lab)
# Handle nodes response
if nodes_response.get("code") == 200:
nodes = nodes_response.get("data", {})
# Store nodes' names, templates, and URLs in a variable for vjunosrouter template only
nodes_list = []
for node_id, node in nodes.items():
if node['template'] == 'vjunosrouter':
node_info = {
"name": node['name'],
"template": node['template'],
"url": node['url']
}
nodes_list.append(node_info)
# Convert the list of nodes to JSON format and store it in a variable
nodes_data = {"nodes": nodes_list}
print("The nodes information has been stored in a variable.")
else:
print(f"Error fetching nodes: {nodes_response.get('message')}")
else:
print(f"Error fetching labs: {labs_response.get('message')}")
else:
print(f"Error fetching folders: {folders_response.get('message')}")
# Extract the name, IP, and Port from the nodes data for vjunosrouter template
nodes_info = []
for node in nodes_data['nodes']:
name = node['name']
url = node['url']
ip_port = url.split('//')[1]
ip, port = ip_port.split(':')
nodes_info.append((name, ip, port))
# Function to connect to a Juniper vJunos router using telnet and power it off
def power_off_device(name, ip, port):
try:
tn = telnetlib.Telnet(ip, port, timeout=10)
tn.write(b"\n\n") # Hit enter a couple of times
tn.read_until(b"login: ", timeout=10)
tn.write(b"root\n")
tn.read_until(b"Password: ", timeout=10)
tn.write(b"juniper1\n")
tn.read_until(b"root@:~ #", timeout=10)
tn.write(b"cli\n")
prompt = tn.read_until(b"> ", timeout=10)
if b"> " in prompt:
tn.write(b"request system power-off\n")
elif b"# " in prompt:
tn.write(b"run request system power-off\n")
tn.read_until(b"Power off the system ? [yes,no] (no) ", timeout=10)
tn.write(b"yes\n")
tn.read_until(b"> ", timeout=10)
tn.write(b"exit\n")
print(f"Successfully powered off {name} at {ip}:{port}")
tn.close()
except Exception as e:
print(f"Failed to power off {name} at {ip}:{port}. Error: {e}")
# Use ThreadPoolExecutor to make the script faster by running tasks concurrently
with ThreadPoolExecutor(max_workers=10) as executor:
futures = [executor.submit(power_off_device, name, ip, port) for name, ip, port in nodes_info]
# Wait for all futures to complete
for future in futures:
future.result()
print("Script execution completed.")
------------------------------
Bandiu Alin-Filip-Gabriel
Original Message:
Sent: 01-13-2025 04:02
From: Simon Bingham (technical debt collector)
Subject: vRouter Corrupted all the time in Eve-NG, Seems more unstable that the older vMX
Can I just say over all how important having this virtual resource is THANKYOU Juniper !!
I've been running vMX, the one where I needed to have the virtual control plane and the FPC as separate VMs in labs for a year or so, and apart from it looking a bit messy on the layout, it's been reasonably stable.
Eve-ng is the pro version, loads of memory, SSDs, Dell R720. Bare Metal install. No other issues I'm aware of.
- EVE-NG version:
5.0.1-144-PRO
- QEMU version:
2.4.0
I've been building a new lab in Eve-ng for my JNCIP-DC re-certification, this time I'm using the single "vRouter" , and what I'm finding is almost all the time when I restart my Eve-ng lab in the morning, one or more VMs are corrupted, interfaces are missing, or one VM just does not boot. Even wiping the VM does not always seem to help I often have to delete the router, add a new one back re- apply the config etc etc.
It takes so long to fix the lab every morning, wasting a lot of my time. I'm going to have to move back to the older VM soon.
I always shut them down from the CLI before powering off my eve-ng lab.
1) Can I please request Juniper Interop test this with Eve-NG ?
2) Is there a secret to this being more stable? is there a older version known to be more stable?
3) Any tips would be appreciated. I'm wasting so much time on this.
root@dc1-leaf2# run show version
Hostname: dc1-leaf2
Model: vmx
Junos: 23.4R2-S2.1
root@dc1-leaf2# show | display set
set version 23.4R2-S2.1
set system host-name dc1-leaf2
set system root-authentication encrypted-password "$6$hb2ULaRS$jRYr0g71PQVnoDKfWyClqC4.ISgYzLyerjYpboJqACPt3Fv0LCSQK.NDGHruNDgZLVeQ6TYKrj7iai.lTtxdJ."
set system services ssh root-login allow
set interfaces ge-0/0/1 unit 0 family inet address 198.51.100.3/31
set interfaces ge-0/0/2 unit 0 family inet address 198.51.100.9/31
set interfaces ge-0/0/5 unit 0 family bridge interface-mode access
set interfaces ge-0/0/5 unit 0 family bridge vlan-id 100
set interfaces fxp0 unit 0 family inet address 172.27.233.114/24
set interfaces lo0 unit 0 family inet address 192.0.2.12/32
set policy-options policy-statement ALLOW-LOOPBACK term LOOPBACKS from interface lo0.0
set policy-options policy-statement ALLOW-LOOPBACK term LOOPBACKS then accept
set routing-instances macvrf-v100-1 instance-type mac-vrf
set routing-instances macvrf-v100-1 protocols evpn encapsulation vxlan
set routing-instances macvrf-v100-1 protocols evpn extended-vni-list 10100
set routing-instances macvrf-v100-1 vtep-source-interface lo0.0
set routing-instances macvrf-v100-1 bridge-domains bd100 vlan-id 100
set routing-instances macvrf-v100-1 bridge-domains bd100 vxlan vni 10100
set routing-instances macvrf-v100-1 service-type vlan-based
set routing-instances macvrf-v100-1 interface ge-0/0/5.0
set routing-instances macvrf-v100-1 route-distinguisher 192.0.2.11:102
set routing-instances macvrf-v100-1 vrf-target target:1:1
set routing-options router-id 192.0.2.12
set routing-options autonomous-system 65422
set protocols bgp group UNDERLAY family inet unicast
set protocols bgp group UNDERLAY export ALLOW-LOOPBACK
set protocols bgp group UNDERLAY local-as 65422
set protocols bgp group UNDERLAY multipath
set protocols bgp group UNDERLAY neighbor 198.51.100.2 peer-as 65500
set protocols bgp group UNDERLAY neighbor 198.51.100.8 peer-as 65500
set protocols bgp group OVERLAY type external
set protocols bgp group OVERLAY multihop ttl 3
set protocols bgp group OVERLAY local-address 192.0.2.12
set protocols bgp group OVERLAY family evpn signaling
set protocols bgp group OVERLAY neighbor 192.0.2.11 peer-as 65421
set protocols bgp group OVERLAY neighbor 192.0.2.13 peer-as 65423
set protocols bgp group OVERLAY neighbor 192.0.2.101 peer-as 65500
set protocols bgp group OVERLAY neighbor 192.0.2.102 peer-as 65500
This is quite a common fault where a number is just repeated in CLI



------------------------------
JNCIE-ENT 907
------------------------------