Corvil: CNE migration #1, active sessions export
I need to replace 8 CNEs with 2 CNEs and migrate the configuration in the main and DR data center. This is the approximate plan which I…
Corvil: CNE migration #1, active sessions export
I need to replace 8 CNEs with 2 CNEs and migrate the configuration in the main and DR data center. This is the approximate plan which I will test on one of our locations.
Currently we have two Data Centers with 8CNEs inside of each and we need to migrate an infrastructure to the new 2 appliances. Let’s say, we know how TapAggs from the current setup will be connected in new infrastructure so we understand precisely how the sessions from the current 8 CNEs will be transferred on new 7450 6450. But the config on each CNE is about 20K lines, we’re sure there are a lot of obsolete configurations and there are definitely unused sessions. Totally we have 7.5k+ sessions. Can we open Notepad++ and replace adhoc needed lines or put them through sed in case we’re normal people? Yes, but we also want to parse our current configuration only through the sessions that we want to see on the current CNEs, we don’t need any additionaly 10000 lines of the code.
So the plan is:
- export the sessions with only active traffic
- export actual config
- match the list of needed sessions with a config
- check the syntax of result config
- apply it
- face many issues with the syntax and configuration, which we didn’t know about (no one left any knowledge or documentation)
- rewrite our script, reapply the configuration
- check the traffic on all new sessions
- face another unexpected errors and fix them
- put all the needed script to CI, cause we’ll need to migrate another region like that
How to export needed sessions?
We had 3 options
- configure dashboard with requested parameters and export the results
- use .py library from Corvil site
- write the own script
We will write our own because having a dashboard is not so flexible, we want it to be reusable, we can’t use the python library cause we don’t have direct access to all the CNEs (yes-yes, it’s the banking infrastructure). Only through the CMC as a jump server, and we don’t want to overload it. The script is quite simple, but first we need to clear all the counters.
clear counters *
once CNE started collecting hits we’ll prepare the script
import csv
import glob
input_file_paths = glob.glob('cne-*.txt')
output_file_path = "session_traffic.csv"
non_zero_traffc_file_path = "non_zero_sessions.txt"
zero_traffic_file_path = "zero_sessions.txt"
sessions = []
non_zero_sessions = []
zero_sessions = []
for input_file_path in input_file_paths:
with open(input_file_path, 'r') as file:
session_name = None
for line in file:
line = line.strip()\
if line.startswith("session "):
session_name = line.split()[1]
elif "Packet Stats" in line:
traffic_stats = line.split(' -')[-1].strip().split()[0]
if session_name:
sessions.append((session_name, traffic_stats))
if traffic_stats != "0":
non_zero_sessions.append(session_name)
session_name = None
print("Non-zero traffic session:")
print(len(non_zero_sessions))
with open)output_file_path, 'w', newline='') as csvfile:
writer = csv.writer(csvfile)
writer.writerow(['SessionName', 'TrafficStats (mbps)'])
writer.writerows(sessions)
with open(non_zero_traffic_file_oath, 'w') as txtfile:
for session in non_zero_sessions:
txtfile.write(session + '\n')
with open(zero_traffic_file_oath, 'w') as txtfile:
for session in zero_sessions:
txtfile.write(session + '\n')
Launch it python script.py
Now we have the list of all active sessions
How to export actual config?
One command — retrieve config, and buy the way we definitely need to setup Jenkins job for it, because we don’t even have any actual backup for Corvil, let’s export the configuration by the scheduler and store it in Artifactory.
another — copy svc
메타데이터
- post_id
- 7bcd82c8fb45
- slug
- corvil-cne-migration-1-active-sessions-export-7bcd82c8fb45
- url
- https://medium.com/@vadimmorozov/corvil-cne-migration-1-active-sessions-export-7bcd82c8fb45
- canonical_url
- https://medium.com/@vadimmorozov/corvil-cne-migration-1-active-sessions-export-7bcd82c8fb45
- author_url
- https://medium.com/@vadimmorozov
- status
- ok
- fetched_at
- 2026-07-20 18:07:58