def config_mpls(mpls): """Add config data to mpls object.""" # tunnel with explicit and dynamic path options tunnel = mpls.lsps.constrained_path.Tunnel() tunnel.name = "LER1-LER2-t58" tunnel.config.name = "LER1-LER2-t58" tunnel.config.type = oc_mpls_types.P2P() tunnel.type = oc_mpls_types.P2P() # explicit path p2p_primary_paths = tunnel.p2p_tunnel_attributes.P2PPrimaryPaths() p2p_primary_paths.name = "LER1-LSR1-LER2" p2p_primary_paths.config.name = "LER1-LSR1-LER2" p2p_primary_paths.config.preference = 10 p2p_primary_paths.config.explicit_path_name = "LER1-LSR1-LER2" path_computation_method = oc_mpls.ExplicitlyDefined() p2p_primary_paths.config.path_computation_method = path_computation_method tunnel.p2p_tunnel_attributes.p2p_primary_paths.append(p2p_primary_paths) # dynamic path p2p_primary_paths = tunnel.p2p_tunnel_attributes.P2PPrimaryPaths() p2p_primary_paths.name = "DYNAMIC" p2p_primary_paths.config.name = "DYNAMIC" p2p_primary_paths.config.preference = 20 path_computation_method = oc_mpls.LocallyComputed() p2p_primary_paths.config.path_computation_method = path_computation_method tunnel.p2p_tunnel_attributes.p2p_primary_paths.append(p2p_primary_paths) tunnel.p2p_tunnel_attributes.config.destination = "172.16.255.2" tunnel.bandwidth.config.set_bandwidth = 100000 mpls.lsps.constrained_path.tunnel.append(tunnel)
def config_mpls(mpls): """Add config data to mpls object.""" # auto-bw tunnel tunnel = mpls.lsps.constrained_path.Tunnel() tunnel.name = "LER1-LER2-t52" tunnel.config.name = "LER1-LER2-t52" tunnel.config.type = oc_mpls_types.P2P() tunnel.type = oc_mpls_types.P2P() p2p_primary_paths = tunnel.p2p_tunnel_attributes.P2PPrimaryPaths() p2p_primary_paths.name = "DYNAMIC" p2p_primary_paths.config.name = "DYNAMIC" p2p_primary_paths.config.preference = 10 path_computation_method = oc_mpls.LocallyComputed() p2p_primary_paths.config.path_computation_method = path_computation_method tunnel.p2p_tunnel_attributes.p2p_primary_paths.append(p2p_primary_paths) tunnel.p2p_tunnel_attributes.config.destination = "172.16.255.2" # auto-bandwidth configuration tunnel.bandwidth.auto_bandwidth.config.enabled = True tunnel.bandwidth.auto_bandwidth.config.min_bw = 10000 tunnel.bandwidth.auto_bandwidth.config.max_bw = 500000 tunnel.bandwidth.auto_bandwidth.overflow.config.overflow_threshold = 15 tunnel.bandwidth.auto_bandwidth.overflow.config.trigger_event_count = 3 tunnel.bandwidth.auto_bandwidth.underflow.config.underflow_threshold = 15 tunnel.bandwidth.auto_bandwidth.underflow.config.trigger_event_count = 3 mpls.lsps.constrained_path.tunnel.append(tunnel)
def config_mpls(network_instances): """Add config data to mpls object.""" # configure default network instance network_instance = network_instances.NetworkInstance() network_instance.name = "default" network_instance.config.name = "default" # dynamic tunnel tunnel = network_instance.mpls.lsps.constrained_path.tunnels.Tunnel() tunnel.name = "LER1-LER2-t50" tunnel.config.name = "LER1-LER2-t50" tunnel.config.type = oc_mpls_types.P2P() #tunnel.type = oc_mpls_types.P2P() p2p_primary_path = tunnel.p2p_tunnel_attributes.p2p_primary_path.P2pPrimaryPath_() p2p_primary_path.name = "DYNAMIC" p2p_primary_path.config.name = "DYNAMIC" p2p_primary_path.config.preference = 10 path_computation_method = oc_mpls_types.LOCALLYCOMPUTED() p2p_primary_path.config.path_computation_method = path_computation_method tunnel.p2p_tunnel_attributes.p2p_primary_path.p2p_primary_path.append(p2p_primary_path) tunnel.p2p_tunnel_attributes.config.destination = "172.16.255.2" tunnel.bandwidth.config.set_bandwidth = 100000 network_instance.mpls.lsps.constrained_path.tunnels.tunnel.append(tunnel) network_instances.network_instance.append(network_instance)
def config_mpls(network_instances): """Add config data to mpls object.""" # configure default network instance network_instance = network_instances.NetworkInstance() network_instance.name = "default" network_instance.config.name = "default" # tunnel with affinity and priority 5/5 tunnel = network_instance.mpls.lsps.constrained_path.tunnels.Tunnel() tunnel.name = "LER1-LER2-t56" tunnel.config.name = "LER1-LER2-t56" tunnel.config.setup_priority = 5 tunnel.config.hold_priority = 5 tunnel.config.type = oc_mpls_types.P2P() p2p_primary_path = tunnel.p2p_tunnel_attributes.p2p_primary_path.P2pPrimaryPath_( ) p2p_primary_path.name = "DYNAMIC" p2p_primary_path.config.name = "DYNAMIC" p2p_primary_path.config.preference = 10 path_computation_method = oc_mpls_types.LOCALLYCOMPUTED() p2p_primary_path.config.path_computation_method = path_computation_method p2p_primary_path.admin_groups.config.exclude_group.append("RED") tunnel.p2p_tunnel_attributes.p2p_primary_path.p2p_primary_path.append( p2p_primary_path) tunnel.p2p_tunnel_attributes.config.destination = "172.16.255.2" tunnel.bandwidth.config.set_bandwidth = 100000 network_instance.mpls.lsps.constrained_path.tunnels.tunnel.append(tunnel) network_instances.network_instance.append(network_instance)
def config_mpls(network_instances): """Add config data to mpls object.""" # configure default network instance network_instance = network_instances.NetworkInstance() network_instance.name = "default" network_instance.config.name = "default" # auto-bw tunnel tunnel = network_instance.mpls.lsps.constrained_path.tunnels.Tunnel() tunnel.name = "LER1-LER2-t52" tunnel.config.name = "LER1-LER2-t52" tunnel.config.type = oc_mpls_types.P2P() #tunnel.type = oc_mpls_types.P2P() p2p_primary_path = tunnel.p2p_tunnel_attributes.p2p_primary_path.P2pPrimaryPath_( ) p2p_primary_path.name = "DYNAMIC" p2p_primary_path.config.name = "DYNAMIC" p2p_primary_path.config.preference = 10 path_computation_method = oc_mpls_types.LOCALLYCOMPUTED() p2p_primary_path.config.path_computation_method = path_computation_method tunnel.p2p_tunnel_attributes.p2p_primary_path.p2p_primary_path.append( p2p_primary_path) tunnel.p2p_tunnel_attributes.config.destination = "172.16.255.2" # auto-bandwidth configuration tunnel.bandwidth.auto_bandwidth.config.enabled = True tunnel.bandwidth.auto_bandwidth.config.min_bw = 10000 tunnel.bandwidth.auto_bandwidth.config.max_bw = 500000 tunnel.bandwidth.auto_bandwidth.overflow.config.overflow_threshold = 15 tunnel.bandwidth.auto_bandwidth.overflow.config.trigger_event_count = 3 tunnel.bandwidth.auto_bandwidth.underflow.config.underflow_threshold = 15 tunnel.bandwidth.auto_bandwidth.underflow.config.trigger_event_count = 3 network_instance.mpls.lsps.constrained_path.tunnels.tunnel.append(tunnel) network_instances.network_instance.append(network_instance)
def config_mpls(mpls): """Add config data to mpls object.""" # tunnel with protection requested tunnel = mpls.lsps.constrained_path.Tunnel() tunnel.name = "LER1-LER2-t54" tunnel.config.name = "LER1-LER2-t54" tunnel.config.type = oc_mpls_types.P2P() tunnel.config.protection_style_requested = oc_mpls_types.LinkProtectionRequested() tunnel.type = oc_mpls_types.P2P() p2p_primary_paths = tunnel.p2p_tunnel_attributes.P2PPrimaryPaths() p2p_primary_paths.name = "DYNAMIC" p2p_primary_paths.config.name = "DYNAMIC" p2p_primary_paths.config.preference = 10 path_computation_method = oc_mpls.LocallyComputed() p2p_primary_paths.config.path_computation_method = path_computation_method tunnel.p2p_tunnel_attributes.p2p_primary_paths.append(p2p_primary_paths) tunnel.p2p_tunnel_attributes.config.destination = "172.16.255.2" tunnel.bandwidth.config.set_bandwidth = 100000 mpls.lsps.constrained_path.tunnel.append(tunnel)
def config_mpls(mpls): """Add config data to mpls object.""" # tunnel with affinity and priority 5/5 tunnel = mpls.lsps.constrained_path.Tunnel() tunnel.name = "LER1-LER2-t56" tunnel.config.name = "LER1-LER2-t56" tunnel.config.setup_priority = 5 tunnel.config.hold_priority = 5 tunnel.config.type = oc_mpls_types.P2P() tunnel.type = oc_mpls_types.P2P() p2p_primary_paths = tunnel.p2p_tunnel_attributes.P2PPrimaryPaths() p2p_primary_paths.name = "DYNAMIC" p2p_primary_paths.config.name = "DYNAMIC" p2p_primary_paths.config.preference = 10 path_computation_method = oc_mpls.LocallyComputed() p2p_primary_paths.config.path_computation_method = path_computation_method p2p_primary_paths.admin_groups.config.exclude_group.append("RED") tunnel.p2p_tunnel_attributes.p2p_primary_paths.append(p2p_primary_paths) tunnel.p2p_tunnel_attributes.config.destination = "172.16.255.2" tunnel.bandwidth.config.set_bandwidth = 100000 mpls.lsps.constrained_path.tunnel.append(tunnel)