打印
[测量]

浅析SR隧道路径批量构造方法

[复制链接]
1698|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
teletest|  楼主 | 2023-11-20 16:46 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
为什么要仿真PCE LSP下发隧道路径?
在大型的多区域网络中,路径计算非常复杂。在某些场景下,为了完成路径计算,需要在控制器上部署特殊的计算组件,并需要不同区域中的节点之间协作。这使得网元在进行路径计算时效率低,还会降低网元本身的转发性能。
PCE最早是为了解决大型的多区域网络路径计算问题而被提出,通过PCE可以为TE计算跨域路径。如下图所示,PCEP网络包含如下3个部分:
PEPCE(Path Computation Element,路径计算单元):PCE是能够基于网络拓扑信息计算满足约束的路径的部件。PCE可以部署在路由设备中,也可以部署在一个独立的服务器中。大多数时候,PCE和控制器是集成在一起的。
PCC(Path Computation Client,路径计算客户端):PCC是请求路径计算单元执行路径计算的客户端应用程序。PCC向PCE发送路径请求,并接受PCE返回的路径计算结果。一般情况下,路由设备集成了PCC功能,可以认为路由设备就是PCC。
PCEP(Path Computation Element Protocol,路径计算单元通信协议):PCEP是PCE和PCC、PCE和PCE之间的通信协议。
3

图1-应用拓扑

序号
说明
1
用户通过配置触发Ingress(即为PCC)请求建立LSP。
2
PCC向PCE服务器发送PCEP Report消息,请求PCE进行LSP托管及路径计算。
3
PCE服务器收到Report消息后,保存LSP信息到LSP DB。根据TEDB和本地策略触发路径计算或全局优化算路。
4
PCE服务器计算完毕后,如果计算结果审核通过,则PCE服务器通过Update消息将计算结果返回给PCC。
5
PCC按照计算结果进行SR-TE路径建立。
自动化生成PCE LSP能解决什么问题?
使用仪表模拟PCE时,需要手工创建PCE LSP,并且涉及转发路径标签的确定,Adj-Sid在每次建立SR邻居时都是随机分配标签值,创建隧道路径又必须明确标签值,在创建大量的隧道路径情况下,使用自动化读取SR隧道数据方法创建PCE LSP可节省大量仪表配置精力。
如何使用自动化构造PCE LSP
信而泰Renix平台提供了python API接口,可使用python API进行PCE LSP灵活定义。假设业务如下所示:
SR-TE单板转发性能:创建ISIS SR-TE业务
PCEP隧道托管:DUT与仪表之间建立SR-TE隧道,并把其中4000条隧道路径托管到PCE。

图2-实验拓扑
本文选择基础API使用信而泰API(renix_py_api、MiscLibrary),不另做定义,使用时需安装相关环境。代码解析如下:
导入相关库:
from renix_py_api.renix import *
import logging
import pandas as pd
初始化:initialize为仪表初始化
initialize(log=True,log_level=logging.INFO,log_handle=LogHandle.LOG_FILE)
chassis_DY = "10.1.1.7"
port_DY_1 = "//10.1.1.7/3/1"
path = 'D:\pcep\pceplsp.xls'
data = pd.DataFrame(pd.read_excel(path))
tunnelnum = 16000
pcelspnum = 4000
创建自动化前需收集隧道路径参数,格式如下表所示(提供前10供参考,本实验共计250条路径用于承载***v4流量,250条路径用于承载6vpe流量):

peer
SourceIpv4Address
DestinationIpv6Address
AdjSid
NodeSid
1
10.48.48.1
10.48.50.1
160001
200001
2
10.48.48.1
10.48.50.2
160002
200002
3
10.48.48.1
10.48.50.3
160003
200003
4
10.48.48.1
10.48.50.4
160004
200004
5
10.48.48.1
10.48.50.5
160005
200005
6
10.48.48.1
10.48.50.6
160006
200006
7
10.48.48.1
10.48.50.7
160007
200007
8
10.48.48.1
10.48.50.8
160008
200008
9
10.48.48.1
10.48.50.9
160009
200009
10
10.48.48.1
10.48.50.10
160010
200010
创建仪表基本配置
sys_entry = get_sys_entry()
sys_entry.edit(ProductType=1)
chassis = ConnectChassisCommand(chassis_DY)
chassis.execute()
port_location = ('//10.1.1.7/3/1')
port_1 = Port(upper=sys_entry, Location=port_location[0], name='port_1')
BringPortsOnlineCommand(PortList=[port_1.handle]).execute()
配置pcep
interface_1 = Interface(upper=port_1)
build_ipv4_ipv6 = BuildInterfaceCommand(InterfaceList='Interface_1', NetworkLayers='eth', TopLayers=['ipv4', 'ipv6'])
build_ipv4_ipv6.execute()
eth_layer = interface_1.get_children('EthIILayer')[0]
eth_layer.edit(Address='00:10:99:00:00:01')
ipv4_layer = interface_1.get_children('Ipv4Layer')[0]
ipv4_layer.edit(Address='12.5.20.2', Step='0.0.0.1', Count='1', Gateway='12.5.20.1')
ipv6_layer = interface_1.get_children('Ipv6Layer')[0]
ipv6_layer.edit(Address='12:5:14::2', Step='::1', Count='1', Gateway='12:5:14::1')
PcepSession = PcepProtocolConfig(upper=port_1)
PcepSession.edit(UseGatewayAsDutIp=False)
PcepSession.edit(PeerIpv4Address="10.48.48.1")
select_interface_1=SelectInterfaceCommand(ProtocolList=[PcepSession.handle], InterfaceList=[interface_1.handle])
select_interface_1.execute()
配置PCE LSP,根据Excel循环创建
tunnelperpeer = int(tunnelnum/250)
counter = 4000
for x in range(250):
    for y in range(tunnelperpeer):
        PceLsp = PceLspConfig(upper=PcepSession)
        SymbolicName = 'Tunnel'+str(x*tunnelperpeer+(y+1))
        PceLsp.edit(SymbolicName=SymbolicName)
        SourceIP = data.loc[x][1]
        PceLsp.edit(SourceIpv4Address=SourceIP)
        DestIP = data.loc[x][2]
        PceLsp.edit(DestinationIpv4Address=DestIP)
        PcepSrEroObject = PcepSrEroObjectConfig(upper=PceLsp)
        PcepSrEroSubObject = PcepSrEroSubObjectConfig(upper=PcepSrEroObject)
        PcepSrEroSubObject.edit(NaiType=3)
        PcepSrEroSubObject.edit(FFlag=True)
        Adjsid = int(data.loc[x][3])
        PcepSrEroSubObject.edit(SidLabel=Adjsid)
        PcepSrEroSubObject = PcepSrEroSubObjectConfig(upper=PcepSrEroObject)
        PcepSrEroSubObject.edit(NaiType=1)
        PcepSrEroSubObject.edit(FFlag=True)
        Nodesid = int(data.loc[x][4])
        PcepSrEroSubObject.edit(SidLabel=Nodesid)
        counter -=1
        if counter == 0:
            break
    if counter == 0:
        break
保存Renix平台对应XCFG文件
    save_case = SaveTestCaseCommand(TestCase='D:\pcep\pcep.xcfg', ProductType=1)
save_case.execute()
执行生成配置文件效果(PCE LSPs)

PCE LSP对应路径(ERO Object)

DarYu-X系列测试仪
DarYu-X系列高性能网络测试仪是信而泰推出的面向高端路由器等高端数通设备的测试产品,具有高性能、高密度、高速率等特点,配置信而泰基于PCT架构的新一代测试软件RENIX和X2系列测试模块,可为提供路由高效组网测试解决方案,为建立一张高SLA保证、确定性时延、业务感知、灵活业务路径调优的下一代网络保驾护航。

使用特权

评论回复

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

147

主题

154

帖子

0

粉丝