Merge pull request #8137 from Orange-OpenSource/ospf_ls

ospfd: Add Link State support
This commit is contained in:
Russ White 2021-03-30 10:28:37 -04:00 committed by GitHub
commit a2d351d19e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 8265 additions and 469 deletions

View File

@ -81,26 +81,47 @@ corresponds to a Link State information conveyed by the routing protocol.
Functions
^^^^^^^^^
A set of functions is provided to create, delete and compare Link State Node:
A set of functions is provided to create, delete and compare Link State
Node, Atribute and Prefix:
.. c:function:: struct ls_node *ls_node_new(struct ls_node_id adv, struct in_addr router_id, struct in6_addr router6_id)
.. c:function:: voidls_node_del(struct ls_node *node)
.. c:function:: int ls_node_same(struct ls_node *n1, struct ls_node *n2)
and Link State Attributes:
.. c:function:: struct ls_attributes *ls_attributes_new(struct ls_node_id adv, struct in_addr local, struct in6_addr local6, uint32_t local_id)
.. c:function:: void ls_attributes_del(struct ls_attributes *attr)
.. c:function:: int ls_attributes_same(struct ls_attributes *a1, struct ls_attributes *a2)
.. c:function:: struct ls_prefix *ls_prefix_new(struct ls_node_id adv, struct prefix p)
Create respectively a new Link State Node, Attribute or Prefix.
Structure is dynamically allocated. Link State Node ID (adv) is mandatory
and:
- at least one of IPv4 or IPv6 must be provided for the router ID
(router_id or router6_id) for Node
- at least one of local, local6 or local_id must be provided for Attribute
- prefix is mandatory for Link State Prefix.
.. c:function:: void ls_node_del(struct ls_node *node)
.. c:function:: void ls_attributes_del(struct ls_attributes *attr)
.. c:function:: void ls_prefix_del(struct ls_prefix *pref)
Remove, respectively Link State Node, Attributes or Prefix.
Data structure is freed.
.. c:function:: void ls_attributes_srlg_del(struct ls_attributes *attr)
Remove SRLGs attribute if defined. Data structure is freed.
.. c:function:: int ls_node_same(struct ls_node *n1, struct ls_node *n2)
.. c:function:: int ls_attributes_same(struct ls_attributes *a1, struct ls_attributes *a2)
.. c:function:: int ls_prefix_same(struct ls_prefix *p1, struct ls_prefix*p2)
Check, respectively if two Link State Nodes, Attributes or Prefix are equal.
Note that these routines have the same return value sense as '==' (which is
different from a comparison).
The low level API doesn't provide any particular functions for the Link State
Prefix structure as this latter is simpler to manipulate.
Link State TED
--------------
This is the high level API that provides functions to create, update, delete a
Link State Database to from a Traffic Engineering Database (TED).
Link State Database to build a Traffic Engineering Database (TED).
Data Structures
^^^^^^^^^^^^^^^
@ -143,35 +164,143 @@ A unique Key is used to identify both Vertices and Edges within the Graph.
.. c:type:: struct ls_prefix
.. c:type:: struct ls_ted
TED stores Vertex, Edge and Subnet elements with a RB Tree structure.
The Vertex key corresponds to the Router ID for OSPF and ISO System ID for
IS-IS. The Edge key corresponds to the IPv4 address, the lowest 64 bits of
the IPv6 address or the combination of the local & remote ID of the interface.
The Subnet key corresponds to the Prefix address (v4 or v6).
Functions
^^^^^^^^^
An additional status for Vertex, Edge and Subnet allows to determine the state
of the element in the TED: UNSET, NEW, UPDATE, DELETE, SYNC, ORPHAN. Normal
state is SYNC. NEW, UPDATE and DELETE are temporary state when element is
processed. UNSET is normally never used and ORPHAN serves to identify elements
that must be remove when TED is cleaning.
Vertex, Edges and Subnets management functions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. c:function:: struct ls_vertex *ls_vertex_add(struct ls_ted *ted, struct ls_node *node)
.. c:function:: struct ls_edge *ls_edge_add(struct ls_ted *ted, struct ls_attributes *attributes)
.. c:function:: struct ls_subnet *ls_subnet_add(struct ls_ted *ted, struct ls_prefix *pref)
Add, respectively new Vertex, Edge or Subnet to the Link State Datebase.
Vertex, Edge or Subnet are created from, respectively the Link State Node,
Attribute or Prefix structure. Data structure are dynamically allocated.
.. c:function:: struct ls_vertex *ls_vertex_update(struct ls_ted *ted, struct ls_node *node)
.. c:function:: struct ls_edge *ls_edge_update(struct ls_ted *ted, struct ls_attributes *attributes)
.. c:function:: struct ls_subnet *ls_subnet_update(struct ls_ted *ted, struct ls_prefix *pref)
Update, respectively Vertex, Edge or Subnet with, respectively the Link
State Node, Attribute or Prefix. A new data structure is created if no one
corresponds to the Link State Node, Attribute or Prefix. If element already
exists in the TED, its associated Link State information is replaced by the
new one if there are different and the old associated Link State information
is deleted and memory freed.
.. c:function:: void ls_vertex_del(struct ls_ted *ted, struct ls_vertex *vertex)
.. c:function:: void ls_vertex_del_all(struct ls_ted *ted, struct ls_vertex *vertex)
.. c:function:: void ls_edge_del(struct ls_ted *ted, struct ls_edge *edge)
.. c:function:: void ls_edge_del_all(struct ls_ted *ted, struct ls_edge *edge)
.. c:function:: void ls_subnet_del(struct ls_ted *ted, struct ls_subnet *subnet)
.. c:function:: void ls_subnet_del_all(struct ls_ted *ted, struct ls_subnet *subnet)
Delete, respectively Link State Vertex, Edge or Subnet. Data structure are
freed but not the associated Link State information with the simple `_del()`
form of the function while the `_del_all()` version freed also associated
Link State information. TED is not modified if Vertex, Edge or Subnet is
NULL or not found in the Data Base. Note that references between Vertices,
Edges and Subnets are removed first.
.. c:function:: struct ls_vertex *ls_find_vertex_by_key(struct ls_ted *ted, const uint64_t key)
.. c:function:: struct ls_vertex *ls_find_vertex_by_id(struct ls_ted *ted, struct ls_node_id id)
.. c:function:: int ls_vertex_same(struct ls_vertex *v1, struct ls_vertex *v2)
.. c:function:: struct ls_edge *ls_edge_add(struct ls_ted *ted, struct ls_attributes *attributes)
.. c:function:: struct ls_edge *ls_edge_update(struct ls_ted *ted, struct ls_attributes *attributes)
.. c:function:: void ls_edge_del(struct ls_ted *ted, struct ls_edge *edge)
Find Vertex in the TED by its unique key or its Link State Node ID.
Return Vertex if found, NULL otherwise.
.. c:function:: struct ls_edge *ls_find_edge_by_key(struct ls_ted *ted, const uint64_t key)
.. c:function:: struct ls_edge *ls_find_edge_by_source(struct ls_ted *ted, struct ls_attributes *attributes);
.. c:function:: struct ls_edge *ls_find_edge_by_destination(struct ls_ted *ted, struct ls_attributes *attributes);
.. c:function:: struct ls_subnet *ls_subnet_add(struct ls_ted *ted, struct ls_prefix *pref)
.. c:function:: void ls_subnet_del(struct ls_ted *ted, struct ls_subnet *subnet)
Find Edge in the Link State Data Base by its key, source or distination
(local IPv4 or IPv6 address or local ID) informations of the Link State
Attributes. Return Edge if found, NULL otherwise.
.. c:function:: struct ls_subnet *ls_find_subnet(struct ls_ted *ted, const struct prefix prefix)
Find Subnet in the Link State Data Base by its key, i.e. the associated
prefix. Return Subnet if found, NULL otherwise.
.. c:function:: int ls_vertex_same(struct ls_vertex *v1, struct ls_vertex *v2)
.. c:function:: int ls_edge_same(struct ls_edge *e1, struct ls_edge *e2)
.. c:function:: int ls_subnet_same(struct ls_subnet *s1, struct ls_subnet *s2)
Check, respectively if two Vertices, Edges or Subnets are equal.
Note that these routines has the same return value sense as '=='
(which is different from a comparison).
TED management functions
^^^^^^^^^^^^^^^^^^^^^^^^
Some helpers functions have been also provided to ease TED management:
.. c:function:: struct ls_ted *ls_ted_new(const uint32_t key, char *name, uint32_t asn)
Create a new Link State Data Base. Key must be different from 0.
Name could be NULL and AS number equal to 0 if unknown.
.. c:function:: void ls_ted_del(struct ls_ted *ted)
.. c:function:: void ls_ted_del_all(struct ls_ted *ted)
Delete existing Link State Data Base. Vertices, Edges, and Subnets are not
removed with ls_ted_del() function while they are with ls_ted_del_all().
.. c:function:: void ls_connect_vertices(struct ls_vertex *src, struct ls_vertex *dst, struct ls_edge *edge)
Connect Source and Destination Vertices by given Edge. Only non NULL source
and destination vertices are connected.
.. c:function:: void ls_connect(struct ls_vertex *vertex, struct ls_edge *edge, bool source)
.. c:function:: void ls_disconnect(struct ls_vertex *vertex, struct ls_edge *edge, bool source)
Connect / Disconnect Link State Edge to the Link State Vertex which could be
a Source (source = true) or a Destination (source = false) Vertex.
.. c:function:: void ls_disconnect_edge(struct ls_edge *edge)
Disconnect Link State Edge from both Source and Destination Vertex.
Note that Edge is not removed but its status is marked as ORPHAN.
.. c:function:: void ls_vertex_clean(struct ls_ted *ted, struct ls_vertex *vertex, struct zclient *zclient)
Clean Vertex structure by removing all Edges and Subnets marked as ORPHAN
from this vertex. Corresponding Link State Update message is sent if zclient
parameter is not NULL. Note that associated Link State Attribute and Prefix
are also removed and memory freed.
.. c:function:: void ls_ted_clean(struct ls_ted *ted)
Clean Link State Data Base by removing all Vertices, Edges and SubNets
marked as ORPHAN. Note that associated Link State Node, Attributes and
Prefix are removed too.
.. c:function:: void ls_show_vertex(struct ls_vertex *vertex, struct vty *vty, struct json_object *json, bool verbose)
.. c:function:: void ls_show_edge(struct ls_edeg *edge, struct vty *vty, struct json_object *json, bool verbose)
.. c:function:: void ls_show_subnet(struct ls_subnet *subnet, struct vty *vty, struct json_object *json, bool verbose)
.. c:function:: void ls_show_vertices(struct ls_ted *ted, struct vty *vty, struct json_object *json, bool verbose)
.. c:function:: void ls_show_edges(struct ls_ted *ted, struct vty *vty, struct json_object *json, bool verbose)
.. c:function:: void ls_show_subnets(struct ls_ted *ted, struct vty *vty, struct json_object *json, bool verbose)
.. c:function:: void ls_show_ted(struct ls_ted *ted, struct vty *vty, struct json_object *json, bool verbose)
Respectively, show Vertex, Edge, Subnet provided as parameter, all Vertices,
all Edges, all Subnets and the whole TED if not specified. Output could be
more detailed with verbose parameter for VTY output. If both JSON and VTY
output are specified, JSON takes precedence over VTY.
.. c:function:: void ls_dump_ted(struct ls_ted *ted)
Dump TED information to the current logging output.
Link State Messages
-------------------
@ -198,8 +327,8 @@ Figure 1 below, illustrates the ZAPI Opaque message exchange between a
message sequences are as follows:
- First, both *Producer* and *Consumer* must register to their respective ZAPI
Opaque Message. **Link State Sync** for the *Producer* in order to receive
Database synchronisation request from a *Consumer*. **Link State Update** for
Opaque Message: **Link State Sync** for the *Producer* in order to receive
Database synchronisation request from a *Consumer*, **Link State Update** for
the *Consumer* in order to received any Link State update from a *Producer*.
These register messages are stored by Zebra to determine to which daemon it
should redistribute the ZAPI messages it receives.
@ -245,22 +374,22 @@ message sequences are as follows:
| | Request LS Sync | v \
| Request LS Sync |<----------------------------| |
|<-----------------------------| | Synchronistation
| LS DB Sync | | Phase
|----------------------------->| LS DB Sync | |
| LS DB Update | | Phase
|----------------------------->| LS DB Update | |
| |---------------------------->| |
| LS DB Sync (cont'd) | | |
|----------------------------->| LS DB Sync (cont'd) | |
| LS DB Update (cont'd) | | |
|----------------------------->| LS DB Update (cont'd) | |
| . |---------------------------->| |
| . | . | |
| . | . | |
| LS DB Sync (end) | . | |
|----------------------------->| LS DB Sync (end) | |
| LS DB Update (end) | . | |
|----------------------------->| LS DB Update (end) | |
| |---------------------------->| |
| | | /
: : :
: : :
| LS Update | | \
|----------------------------->| LS Update | |
| LS DB Update | | \
|----------------------------->| LS DB Update | |
| |---------------------------->| Update Phase
| | | |
: : : /
@ -269,7 +398,7 @@ message sequences are as follows:
| | Unregister LS Update | |
| |<----------------------------| Deregister Phase
| | | |
| LS Update | | |
| LS DB Update | | |
|----------------------------->| | |
| | | /
| | |
@ -305,10 +434,65 @@ Opaque Link State type at once.
Functions
^^^^^^^^^
.. c:function:: int ls_register(struct zclient *zclient, bool server)
.. c:function:: int ls_unregister(struct zclient *zclient, bool server)
Register / Unregister daemon to received ZAPI Link State Opaque messages.
Server must be set to true for *Producer* and to false for *Consumer*.
.. c:function:: int ls_request_sync(struct zclient *zclient)
Request initial Synchronisation to collect the whole Link State Database.
.. c:function:: struct ls_message *ls_parse_msg(struct stream *s)
Parse Link State Message from stream. Used this function once receiving a
new ZAPI Opaque message of type Link State.
.. c:function:: void ls_delete_msg(struct ls_message *msg)
Delete existing message. Data structure is freed.
.. c:function:: int ls_send_msg(struct zclient *zclient, struct ls_message *msg, struct zapi_opaque_reg_info *dst)
Send Link State Message as new ZAPI Opaque message of type Link State.
If destination is not NULL, message is sent as Unicast otherwise it is
broadcast to all registered daemon.
.. c:function:: struct ls_message *ls_vertex2msg(struct ls_message *msg, struct ls_vertex *vertex)
.. c:function:: struct ls_message *ls_edge2msg(struct ls_message *msg, struct ls_edge *edge)
.. c:function:: struct ls_message *ls_subnet2msg(struct ls_message *msg, struct ls_subnet *subnet)
Create respectively a new Link State Message from a Link State Vertex, Edge
or Subnet. If Link State Message is NULL, a new data structure is
dynamically allocated. Note that the Vertex, Edge and Subnet status is used
to determine the corresponding Link State Message event: ADD, UPDATE,
DELETE, SYNC.
.. c:function:: int ls_msg2vertex(struct ls_ted *ted, struct ls_message *msg)
.. c:function:: int ls_msg2edge(struct ls_ted *ted, struct ls_message *msg)
.. c:function:: int ls_msg2subnet(struct ls_ted *ted, struct ls_message *msg)
Convert Link State Message respectively in Vertex, Edge or Subnet and
update the Link State Database accordingly to the message event: SYNC, ADD,
UPDATE or DELETE.
.. c:function:: struct ls_element *ls_msg2ted(struct ls_ted *ted, struct ls_message *msg, bool delete)
.. c:function:: struct ls_element *ls_stream2ted(struct ls_ted *ted, struct ls_message *msg, bool delete)
Convert Link State Message or Stream Buffer in a Link State element (Vertex,
Edge or Subnet) and update the Link State Database accordingly to the
message event: SYNC, ADD, UPDATE or DELETE. The function return the generic
structure ls_element that point to the Vertex, Edge or Subnet which has been
added, updated or synchronous in the database. Note that the delete boolean
parameter governs the action for the DELETE action: true, Link State Element
is removed from the database and NULL is return. If set to false, database
is not updated and the function sets the Link State Element status to
Delete and return the element for futur deletion by the calling function.
.. c:function:: int ls_sync_ted(struct ls_ted *ted, struct zclient *zclient, struct zapi_opaque_reg_info *dst)
Send all the content of the Link State Data Base to the given destination.
Link State content is sent is this order: Vertices, Edges then Subnet.
This function must be used when a daemon request a Link State Data Base
Synchronization.

View File

@ -846,6 +846,13 @@ Traffic Engineering
flood in AREA <area-id> with Opaque Type-10, respectively in AS with Opaque
Type-11. In all case, Opaque-LSA TLV=6.
.. index:: mpls-te export
.. clicmd:: no mpls-te export
Export Traffic Engineering Data Base to other daemons through the ZAPI
Opaque Link State messages.
.. index:: show ip ospf mpls-te interface
.. clicmd:: show ip ospf mpls-te interface
.. clicmd:: show ip ospf mpls-te interface INTERFACE
@ -856,6 +863,20 @@ Traffic Engineering
Show Traffic Engineering router parameters.
.. index:: show ip ospf mpls-te database [verbose|json]
.. clicmd:: show ip ospf mpls-te database [verbose|json]
.. index:: show ip ospf mpls-te database vertex [self-originate|adv-router ADV-ROUTER] [verbose|json]
.. clicmd:: show ip ospf mpls-te database vertex [self-originate|adv-router ADV-ROUTER] [verbose|json]
.. index:: show ip ospf mpls-te database edge [A.B.C.D] [verbose|json]
.. clicmd:: show ip ospf mpls-te database edge [A.B.C.D] [verbose|json]
.. index:: show ip ospf mpls-te database subnet [A.B.C.D/M] [verbose|json]
.. clicmd:: show ip ospf mpls-te database subnet [A.B.C.D/M] [verbose|json]
Show Traffic Engineering Database
.. _router-information:
Router Information

View File

@ -131,3 +131,15 @@ keyword. At present, no sharp commands will be preserved in the config.
Send an ARP/NDP request to trigger the addition of a neighbor in the ARP
table.
.. clicmd:: sharp import-te
Import Traffic Engineering Database produce by OSPF or IS-IS.
.. clicmd:: show sharp ted [verbose|json]
.. clicmd:: show sharp ted [<vertex [A.B.C.D]|edge [A.B.C.D]|subnet [A.B.C.D/M]>] [verbose|json]
Show imported Traffic Engineering Data Base

File diff suppressed because it is too large Load Diff

View File

@ -53,20 +53,26 @@ extern "C" {
* id for OSPF and the ISO System id plus the IS-IS level for IS-IS.
*/
/* external reference */
struct zapi_opaque_reg_info;
struct zclient;
/* Link State Common definitions */
#define MAX_NAME_LENGTH 256
#define ISO_SYS_ID_LEN 6
/* Type of Node */
enum ls_node_type {
NONE = 0, /* Unknown */
STANDARD, /* a P or PE node */
ABR, /* an Array Border Node */
ASBR, /* an Autonomous System Border Node */
PSEUDO, /* a Pseudo Node */
RMT_ASBR, /* Remote ASBR */
PSEUDO /* a Pseudo Node */
};
/* Origin of the Link State information */
enum ls_origin {NONE = 0, ISIS_L1, ISIS_L2, OSPFv2, DIRECT, STATIC};
enum ls_origin { UNKNOWN = 0, ISIS_L1, ISIS_L2, OSPFv2, DIRECT, STATIC };
/**
* Link State Node Identifier as:
@ -108,19 +114,17 @@ struct ls_node {
struct in_addr router_id; /* IPv4 Router ID */
struct in6_addr router6_id; /* IPv6 Router ID */
uint8_t node_flag; /* IS-IS or OSPF Node flag */
enum node_type type; /* Type of Node */
enum ls_node_type type; /* Type of Node */
uint32_t as_number; /* Local or neighbor AS number */
struct { /* Segment Routing Global Block */
struct ls_srgb { /* Segment Routing Global Block */
uint32_t lower_bound; /* MPLS label lower bound */
uint32_t range_size; /* MPLS label range size */
uint8_t flag; /* IS-IS SRGB flags */
} srgb;
#define LS_NODE_SRGB_SIZE 9
struct { /* Segment Routing Local Block */
struct ls_srlb { /* Segment Routing Local Block */
uint32_t lower_bound; /* MPLS label lower bound */
uint32_t range_size; /* MPLS label range size */
} srlb;
#define LS_NODE_SRLB_SIZE 8
uint8_t algo[2]; /* Segment Routing Algorithms */
uint8_t msd; /* Maximum Stack Depth */
};
@ -150,17 +154,17 @@ struct ls_node {
#define LS_ATTR_AVA_BW 0x00100000
#define LS_ATTR_RSV_BW 0x00200000
#define LS_ATTR_USE_BW 0x00400000
#define LS_ATTR_ADJ_SID 0x00800000
#define LS_ATTR_BCK_ADJ_SID 0x01000000
#define LS_ATTR_SRLG 0x02000000
#define LS_ATTR_ADJ_SID 0x01000000
#define LS_ATTR_BCK_ADJ_SID 0x02000000
#define LS_ATTR_SRLG 0x10000000
/* Link State Attributes */
struct ls_attributes {
uint32_t flags; /* Flag for parameters validity */
struct ls_node_id adv; /* Adv. Router of this Link State */
char name[MAX_NAME_LENGTH]; /* Name of the Edge. Could be null */
struct { /* Standard TE metrics */
uint32_t metric; /* IGP standard metric */
uint32_t metric; /* IGP standard metric */
struct ls_standard { /* Standard TE metrics */
uint32_t te_metric; /* Traffic Engineering metric */
uint32_t admin_group; /* Administrative Group */
struct in_addr local; /* Local IPv4 address */
@ -176,8 +180,7 @@ struct ls_attributes {
struct in_addr remote_addr; /* Remote IPv4 address */
struct in6_addr remote_addr6; /* Remote IPv6 address */
} standard;
#define LS_ATTR_STANDARD_SIZE 124
struct { /* Extended TE Metrics */
struct ls_extended { /* Extended TE Metrics */
uint32_t delay; /* Unidirectional average delay */
uint32_t min_delay; /* Unidirectional minimum delay */
uint32_t max_delay; /* Unidirectional maximum delay */
@ -187,8 +190,7 @@ struct ls_attributes {
float rsv_bw; /* Reserved Bandwidth */
float used_bw; /* Utilized Bandwidth */
} extended;
#define LS_ATTR_EXTENDED_SIZE 32
struct { /* (LAN)-Adjacency SID for OSPF */
struct ls_adjacency { /* (LAN)-Adjacency SID for OSPF */
uint32_t sid; /* SID as MPLS label or index */
uint8_t flags; /* Flags */
uint8_t weight; /* Administrative weight */
@ -197,7 +199,6 @@ struct ls_attributes {
uint8_t sysid[ISO_SYS_ID_LEN]; /* or Sys-ID for ISIS */
} neighbor;
} adj_sid[2]; /* Primary & Backup (LAN)-Adj. SID */
#define LS_ATTR_ADJ_SID_SIZE 120
uint32_t *srlgs; /* List of Shared Risk Link Group */
uint8_t srlg_len; /* number of SRLG in the list */
};
@ -219,7 +220,7 @@ struct ls_prefix {
uint32_t route_tag; /* IGP Route Tag */
uint64_t extended_tag; /* IGP Extended Route Tag */
uint32_t metric; /* Route metric for this prefix */
struct {
struct ls_sid {
uint32_t sid; /* Segment Routing ID */
uint8_t sid_flag; /* Segment Routing Flags */
uint8_t algo; /* Algorithm for Segment Routing */
@ -272,10 +273,17 @@ extern struct ls_attributes *ls_attributes_new(struct ls_node_id adv,
struct in6_addr local6,
uint32_t local_id);
/**
* Remove SRLGs from Link State Attributes if defined.
*
* @param attr Pointer to a valid Link State Attribute structure
*/
extern void ls_attributes_srlg_del(struct ls_attributes *attr);
/**
* Remove Link State Attributes. Data structure is freed.
*
* @param attr Pointer to a valid Link State Attribute structure
* @param attr Pointer to a valid Link State Attribute structure
*/
extern void ls_attributes_del(struct ls_attributes *attr);
@ -291,6 +299,34 @@ extern void ls_attributes_del(struct ls_attributes *attr);
extern int ls_attributes_same(struct ls_attributes *a1,
struct ls_attributes *a2);
/**
* Create a new Link State Prefix. Structure is dynamically allocated.
*
* @param adv Mandatory Link State Node ID i.e. advertise router ID
* @param p Mandatory Prefix
*
* @return New Link State Prefix
*/
extern struct ls_prefix *ls_prefix_new(struct ls_node_id adv, struct prefix p);
/**
* Remove Link State Prefix. Data Structure is freed.
*
* @param pref Pointer to a valid Link State Attribute Prefix.
*/
extern void ls_prefix_del(struct ls_prefix *pref);
/**
* Check if two Link State Prefix are equal. Note that this routine has the
* same return value sense as '==' (which is different from a comparison).
*
* @param p1 First Link State Prefix to be compare
* @param p2 Second Link State Prefix to be compare
*
* @return 1 if equal, 0 otherwise
*/
extern int ls_prefix_same(struct ls_prefix *p1, struct ls_prefix *p2);
/**
* In addition a Graph model is defined as an overlay on top of link state
* database in order to ease Path Computation algorithm implementation.
@ -323,9 +359,14 @@ extern int ls_attributes_same(struct ls_attributes *a1,
*
*/
enum ls_status { UNSET = 0, NEW, UPDATE, DELETE, SYNC, ORPHAN };
enum ls_type { GENERIC = 0, VERTEX, EDGE, SUBNET };
/* Link State Vertex structure */
PREDECL_RBTREE_UNIQ(vertices);
struct ls_vertex {
enum ls_type type; /* Link State Type */
enum ls_status status; /* Status of the Vertex in the TED */
struct vertices_item entry; /* Entry in RB Tree */
uint64_t key; /* Unique Key identifier */
struct ls_node *node; /* Link State Node */
@ -337,6 +378,8 @@ struct ls_vertex {
/* Link State Edge structure */
PREDECL_RBTREE_UNIQ(edges);
struct ls_edge {
enum ls_type type; /* Link State Type */
enum ls_status status; /* Status of the Edge in the TED */
struct edges_item entry; /* Entry in RB tree */
uint64_t key; /* Unique Key identifier */
struct ls_attributes *attributes; /* Link State attributes */
@ -347,10 +390,12 @@ struct ls_edge {
/* Link State Subnet structure */
PREDECL_RBTREE_UNIQ(subnets);
struct ls_subnet {
enum ls_type type; /* Link State Type */
enum ls_status status; /* Status of the Subnet in the TED */
struct subnets_item entry; /* Entry in RB tree */
struct prefix key; /* Unique Key identifier */
struct ls_vertex *vertex; /* Back pointer to the Vertex owner */
struct ls_prefix *ls_pref; /* Link State Prefix */
struct ls_vertex *vertex; /* Back pointer to the Vertex owner */
};
/* Declaration of Vertices, Edges and Prefixes RB Trees */
@ -386,25 +431,12 @@ struct ls_ted {
struct subnets_head subnets; /* List of Subnets */
};
/**
* Create a new Link State Vertex structure and initialize is with the Link
* State Node parameter.
*
* @param node Link State Node
*
* @return New Vertex
*/
extern struct ls_vertex *ls_vertex_new(struct ls_node *node);
/**
* Delete Link State Vertex. This function clean internal Vertex lists (incoming
* and outgoing Link State Edge and Link State Subnet). Note that referenced
* objects of the different lists (Edges & SubNet) are not removed as they could
* be connected to other Vertices.
*
* @param vertex Link State Vertex to be removed
*/
extern void ls_vertex_del(struct ls_vertex *vertex);
/* Generic Link State Element */
struct ls_element {
enum ls_type type; /* Link State Element Type */
enum ls_status status; /* Link State Status in the TED */
void *data; /* Link State payload */
};
/**
* Add new vertex to the Link State DB. Vertex is created from the Link State
@ -418,6 +450,27 @@ extern void ls_vertex_del(struct ls_vertex *vertex);
extern struct ls_vertex *ls_vertex_add(struct ls_ted *ted,
struct ls_node *node);
/**
* Delete Link State Vertex. This function clean internal Vertex lists (incoming
* and outgoing Link State Edge and Link State Subnet). Vertex Data structure
* is freed but not the Link State Node. Link State DB is not modified if Vertex
* is NULL or not found in the Data Base. Note that referenced to Link State
* Edges & SubNets are not removed as they could be connected to other Vertices.
*
* @param ted Traffic Engineering Database structure
* @param vertex Link State Vertex to be removed
*/
extern void ls_vertex_del(struct ls_ted *ted, struct ls_vertex *vertex);
/**
* Delete Link State Vertex as ls_vertex_del() but also removed associated
* Link State Node.
*
* @param ted Traffic Engineering Database structure
* @param vertex Link State Vertex to be removed
*/
extern void ls_vertex_del_all(struct ls_ted *ted, struct ls_vertex *vertex);
/**
* Update Vertex with the Link State Node. A new vertex is created if no one
* corresponds to the Link State Node.
@ -431,15 +484,15 @@ extern struct ls_vertex *ls_vertex_update(struct ls_ted *ted,
struct ls_node *node);
/**
* Remove Vertex from the Link State DB. Vertex Data structure is freed but
* not the Link State Node. Link State DB is not modified if Vertex is NULL or
* not found in the Data Base.
* Clean Vertex structure by removing all Edges and Subnets marked as ORPHAN
* from this vertex. Link State Update message is sent if zclient is not NULL.
*
* @param ted Link State Data Base
* @param vertex Vertex to be removed
* @param vertex Link State Vertex to be cleaned
* @param zclient Reference to Zebra Client
*/
extern void ls_vertex_remove(struct ls_ted *ted, struct ls_vertex *vertex);
extern void ls_vertex_clean(struct ls_ted *ted, struct ls_vertex *vertex,
struct zclient *zclient);
/**
* Find Vertex in the Link State DB by its unique key.
*
@ -497,6 +550,17 @@ extern struct ls_edge *ls_edge_add(struct ls_ted *ted,
extern struct ls_edge *ls_edge_update(struct ls_ted *ted,
struct ls_attributes *attributes);
/**
* Check if two Edges are equal. Note that this routine has the same return
* value sense as '==' (which is different from a comparison).
*
* @param e1 First edge to compare
* @param e2 Second edge to compare
*
* @return 1 if equal, 0 otherwise
*/
extern int ls_edge_same(struct ls_edge *e1, struct ls_edge *e2);
/**
* Remove Edge from the Link State DB. Edge data structure is freed but not the
* Link State Attributes data structure. Link State DB is not modified if Edge
@ -507,6 +571,15 @@ extern struct ls_edge *ls_edge_update(struct ls_ted *ted,
*/
extern void ls_edge_del(struct ls_ted *ted, struct ls_edge *edge);
/**
* Remove Edge and associated Link State Attributes from the Link State DB.
* Link State DB is not modified if Edge is NULL or not found.
*
* @param ted Link State Data Base
* @param edge Edge to be removed
*/
extern void ls_edge_del_all(struct ls_ted *ted, struct ls_edge *edge);
/**
* Find Edge in the Link State Data Base by Edge key.
*
@ -520,8 +593,7 @@ extern struct ls_edge *ls_find_edge_by_key(struct ls_ted *ted,
/**
* Find Edge in the Link State Data Base by the source (local IPv4 or IPv6
* address or local ID) informations of the Link
* State Attributes
* address or local ID) informations of the Link State Attributes
*
* @param ted Link State Data Base
* @param attributes Link State Attributes
@ -556,6 +628,29 @@ ls_find_edge_by_destination(struct ls_ted *ted,
extern struct ls_subnet *ls_subnet_add(struct ls_ted *ted,
struct ls_prefix *pref);
/**
* Update the Link State Prefix information of an existing Subnet. If there is
* no corresponding Subnet in the Link State Data Base, a new Subnet is created.
*
* @param ted Link State Data Base
* @param pref Link State Prefix
*
* @return Updated Link State Subnet, or NULL in case of error
*/
extern struct ls_subnet *ls_subnet_update(struct ls_ted *ted,
struct ls_prefix *pref);
/**
* Check if two Subnets are equal. Note that this routine has the same return
* value sense as '==' (which is different from a comparison).
*
* @param s1 First subnet to compare
* @param s2 Second subnet to compare
*
* @return 1 if equal, 0 otherwise
*/
extern int ls_subnet_same(struct ls_subnet *s1, struct ls_subnet *s2);
/**
* Remove Subnet from the Link State DB. Subnet data structure is freed but
* not the Link State prefix data structure. Link State DB is not modified
@ -566,6 +661,15 @@ extern struct ls_subnet *ls_subnet_add(struct ls_ted *ted,
*/
extern void ls_subnet_del(struct ls_ted *ted, struct ls_subnet *subnet);
/**
* Remove Subnet and the associated Link State Prefix from the Link State DB.
* Link State DB is not modified if Subnet is NULL or not found.
*
* @param ted Link State Data Base
* @param subnet Subnet to be removed
*/
extern void ls_subnet_del_all(struct ls_ted *ted, struct ls_subnet *subnet);
/**
* Find Subnet in the Link State Data Base by prefix.
*
@ -582,7 +686,7 @@ extern struct ls_subnet *ls_find_subnet(struct ls_ted *ted,
*
* @param key Unique key of the data base. Must be different from 0
* @param name Name of the data base (may be NULL)
* @param asn AS Number for this data base. Must be different from 0
* @param asn AS Number for this data base. 0 if unknown
*
* @return New Link State Database or NULL in case of error
*/
@ -590,12 +694,28 @@ extern struct ls_ted *ls_ted_new(const uint32_t key, const char *name,
uint32_t asn);
/**
* Delete existing Link State Data Base.
* Delete existing Link State Data Base. Vertices, Edges, and Subnets are not
* removed.
*
* @param ted Link State Data Base
*/
extern void ls_ted_del(struct ls_ted *ted);
/**
* Delete all Link State Vertices, Edges and SubNets and the Link State DB.
*
* @param ted Link State Data Base
*/
extern void ls_ted_del_all(struct ls_ted *ted);
/**
* Clean Link State Data Base by removing all Vertices, Edges and SubNets marked
* as ORPHAN.
*
* @param ted Link State Data Base
*/
extern void ls_ted_clean(struct ls_ted *ted);
/**
* Connect Source and Destination Vertices by given Edge. Only non NULL source
* and destination vertices are connected.
@ -657,6 +777,7 @@ extern void ls_disconnect_edge(struct ls_edge *edge);
*/
/* ZAPI Opaque Link State Message Event */
#define LS_MSG_EVENT_UNDEF 0
#define LS_MSG_EVENT_SYNC 1
#define LS_MSG_EVENT_ADD 2
#define LS_MSG_EVENT_UPDATE 3
@ -679,6 +800,35 @@ struct ls_message {
} data;
};
/**
* Register Link State daemon as a server or client for Zebra OPAQUE API.
*
* @param zclient Zebra client structure
* @param server Register daemon as a server (true) or as a client (false)
*
* @return 0 if success, -1 otherwise
*/
extern int ls_register(struct zclient *zclient, bool server);
/**
* Unregister Link State daemon as a server or client for Zebra OPAQUE API.
*
* @param zclient Zebra client structure
* @param server Unregister daemon as a server (true) or as a client (false)
*
* @return 0 if success, -1 otherwise
*/
extern int ls_unregister(struct zclient *zclient, bool server);
/**
* Send Link State SYNC message to request the complete Link State Database.
*
* @param zclient Zebra client
*
* @return 0 if success, -1 otherwise
*/
extern int ls_request_sync(struct zclient *zclient);
/**
* Parse Link State Message from stream. Used this function once receiving a
* new ZAPI Opaque message of type Link State.
@ -690,7 +840,7 @@ struct ls_message {
extern struct ls_message *ls_parse_msg(struct stream *s);
/**
* Delete existing message, freeing all substructure.
* Delete existing message. Data structure is freed.
*
* @param msg Link state message to be deleted
*/
@ -750,6 +900,81 @@ extern struct ls_message *ls_edge2msg(struct ls_message *msg,
extern struct ls_message *ls_subnet2msg(struct ls_message *msg,
struct ls_subnet *subnet);
/**
* Convert Link State Message into Vertex and update TED accordingly to
* the message event: SYNC, ADD, UPDATE or DELETE.
*
* @param ted Link State Database
* @param msg Link State Message
* @param delete True to delete the Link State Vertex from the Database,
* False otherwise. If true, return value is NULL in case
* of deletion.
*
* @return Vertex if success, NULL otherwise or if Vertex is removed
*/
extern struct ls_vertex *ls_msg2vertex(struct ls_ted *ted,
struct ls_message *msg, bool delete);
/**
* Convert Link State Message into Edge and update TED accordingly to
* the message event: SYNC, ADD, UPDATE or DELETE.
*
* @param ted Link State Database
* @param msg Link State Message
* @param delete True to delete the Link State Edge from the Database,
* False otherwise. If true, return value is NULL in case
* of deletion.
*
* @return Edge if success, NULL otherwise or if Edge is removed
*/
extern struct ls_edge *ls_msg2edge(struct ls_ted *ted, struct ls_message *msg,
bool delete);
/**
* Convert Link State Message into Subnet and update TED accordingly to
* the message event: SYNC, ADD, UPDATE or DELETE.
*
* @param ted Link State Database
* @param msg Link State Message
* @param delete True to delete the Link State Subnet from the Database,
* False otherwise. If true, return value is NULL in case
* of deletion.
*
* @return Subnet if success, NULL otherwise or if Subnet is removed
*/
extern struct ls_subnet *ls_msg2subnet(struct ls_ted *ted,
struct ls_message *msg, bool delete);
/**
* Convert Link State Message into Link State element (Vertex, Edge or Subnet)
* and update TED accordingly to the message event: SYNC, ADD, UPDATE or DELETE.
*
* @param ted Link State Database
* @param msg Link State Message
* @param delete True to delete the Link State Element from the Database,
* False otherwise. If true, return value is NULL in case
* of deletion.
*
* @return Element if success, NULL otherwise or if Element is removed
*/
extern struct ls_element *ls_msg2ted(struct ls_ted *ted, struct ls_message *msg,
bool delete);
/**
* Convert stream buffer into Link State element (Vertex, Edge or Subnet) and
* update TED accordingly to the message event: SYNC, ADD, UPDATE or DELETE.
*
* @param ted Link State Database
* @param s Stream buffer
* @param delete True to delete the Link State Element from the Database,
* False otherwise. If true, return value is NULL in case
* of deletion.
*
* @return Element if success, NULL otherwise or if Element is removed
*/
extern struct ls_element *ls_stream2ted(struct ls_ted *ted, struct stream *s,
bool delete);
/**
* Send all the content of the Link State Data Base to the given destination.
* Link State content is sent is this order: Vertices, Edges, Subnet.
@ -765,6 +990,92 @@ extern struct ls_message *ls_subnet2msg(struct ls_message *msg,
extern int ls_sync_ted(struct ls_ted *ted, struct zclient *zclient,
struct zapi_opaque_reg_info *dst);
struct json_object;
struct vty;
/**
* Show Link State Vertex information. If both vty and json are specified,
* Json format output supersedes standard vty output.
*
* @param vertex Link State Vertex to show. Must not be NULL
* @param vty Pointer to vty output, could be NULL
* @param json Pointer to json output, could be NULL
* @param verbose Set to true for more detail
*/
extern void ls_show_vertex(struct ls_vertex *vertex, struct vty *vty,
struct json_object *json, bool verbose);
/**
* Show all Link State Vertices information. If both vty and json are specified,
* Json format output supersedes standard vty output.
*
* @param ted Link State Data Base. Must not be NULL
* @param vty Pointer to vty output, could be NULL
* @param json Pointer to json output, could be NULL
* @param verbose Set to true for more detail
*/
extern void ls_show_vertices(struct ls_ted *ted, struct vty *vty,
struct json_object *json, bool verbose);
/**
* Show Link State Edge information. If both vty and json are specified,
* Json format output supersedes standard vty output.
*
* @param edge Link State Edge to show. Must not be NULL
* @param vty Pointer to vty output, could be NULL
* @param json Pointer to json output, could be NULL
* @param verbose Set to true for more detail
*/
extern void ls_show_edge(struct ls_edge *edge, struct vty *vty,
struct json_object *json, bool verbose);
/**
* Show all Link State Edges information. If both vty and json are specified,
* Json format output supersedes standard vty output.
*
* @param ted Link State Data Base. Must not be NULL
* @param vty Pointer to vty output, could be NULL
* @param json Pointer to json output, could be NULL
* @param verbose Set to true for more detail
*/
extern void ls_show_edges(struct ls_ted *ted, struct vty *vty,
struct json_object *json, bool verbose);
/**
* Show Link State Subnets information. If both vty and json are specified,
* Json format output supersedes standard vty output.
*
* @param subnet Link State Subnet to show. Must not be NULL
* @param vty Pointer to vty output, could be NULL
* @param json Pointer to json output, could be NULL
* @param verbose Set to true for more detail
*/
extern void ls_show_subnet(struct ls_subnet *subnet, struct vty *vty,
struct json_object *json, bool verbose);
/**
* Show all Link State Subnet information. If both vty and json are specified,
* Json format output supersedes standard vty output.
*
* @param ted Link State Data Base. Must not be NULL
* @param vty Pointer to vty output, could be NULL
* @param json Pointer to json output, could be NULL
* @param verbose Set to true for more detail
*/
extern void ls_show_subnets(struct ls_ted *ted, struct vty *vty,
struct json_object *json, bool verbose);
/**
* Show Link State Data Base information. If both vty and json are specified,
* Json format output supersedes standard vty output.
*
* @param ted Link State Data Base to show. Must not be NULL
* @param vty Pointer to vty output, could be NULL
* @param json Pointer to json output, could be NULL
* @param verbose Set to true for more detail
*/
extern void ls_show_ted(struct ls_ted *ted, struct vty *vty,
struct json_object *json, bool verbose);
/**
* Dump all Link State Data Base elements for debugging purposes
*

View File

@ -1134,7 +1134,7 @@ int zapi_opaque_reg_decode(struct stream *msg,
*/
enum zapi_opaque_registry {
/* Request link-state database dump, at restart for example */
LINK_STATE_REQUEST = 1,
LINK_STATE_SYNC = 1,
/* Update containing link-state db info */
LINK_STATE_UPDATE = 2,
/* Request LDP-SYNC state from LDP */

File diff suppressed because it is too large Load Diff

View File

@ -74,25 +74,29 @@
#define GMPLS 0x02
#define INTER_AS 0x04
#define PSEUDO_TE 0x08
#define FLOOD_AREA 0x10
#define FLOOD_AS 0x20
#define EMULATED 0x80
#define EMULATED 0x10
#define IS_STD_TE(x) (x & STD_TE)
#define IS_STD_TE(x) (x & STD_TE)
#define IS_PSEUDO_TE(x) (x & PSEUDO_TE)
#define IS_INTER_AS(x) (x & INTER_AS)
#define IS_EMULATED(x) (x & EMULATED)
#define IS_FLOOD_AREA(x) (x & FLOOD_AREA)
#define IS_FLOOD_AS(x) (x & FLOOD_AS)
#define IS_INTER_AS_EMU(x) (x & INTER_AS & EMULATED)
#define IS_INTER_AS_AS(x) (x & INTER_AS & FLOOD_AS)
/* Flags to manage TE Link LSA */
#define LPFLG_LSA_INACTIVE 0x0
#define LPFLG_LSA_ACTIVE 0x1
#define LPFLG_LSA_ENGAGED 0x2
#define LPFLG_LOOKUP_DONE 0x4
#define LPFLG_LSA_FORCED_REFRESH 0x8
#define LPFLG_LSA_INACTIVE 0x00
#define LPFLG_LSA_ACTIVE 0x01
#define LPFLG_LSA_ENGAGED 0x02
#define LPFLG_LOOKUP_DONE 0x04
#define LPFLG_LSA_FORCED_REFRESH 0x08
#define LPFLG_LSA_FLOOD_AS 0x10
#define IS_FLOOD_AS(x) (x & LPFLG_LSA_FLOOD_AS)
/* Macro to log debug message */
#define ote_debug(...) \
do { \
if (IS_DEBUG_OSPF_TE) \
zlog_debug(__VA_ARGS__); \
} while (0)
/*
* Following section defines TLV body parts.
@ -336,9 +340,13 @@ struct te_link_subtlv {
/* Following structure are internal use only. */
struct ospf_mpls_te {
/* Status of MPLS-TE: enable or disbale */
/* Status of MPLS-TE: enable or disable */
bool enabled;
/* Traffic Engineering Database i.e. Link State */
struct ls_ted *ted;
bool export;
/* RFC5392 */
enum inter_as_mode inter_as;
struct in_addr interas_areaid;
@ -414,4 +422,15 @@ extern void set_linkparams_llri(struct mpls_te_link *, uint32_t, uint32_t);
extern void set_linkparams_lrrid(struct mpls_te_link *, struct in_addr,
struct in_addr);
struct zapi_opaque_reg_info;
/**
* Call when a client send a Link State Sync message. In turn, OSPF will send
* the contain of the Link State Data base.
*
* @param info ZAPI Opaque message information
*
* @return 0 on success, -1 otherwise
*/
extern int ospf_te_sync_ted(struct zapi_opaque_reg_info dst);
#endif /* _ZEBRA_OSPF_MPLS_TE_H */

View File

@ -2043,6 +2043,7 @@ static int ospf_opaque_msg_handler(ZAPI_CALLBACK_ARGS)
struct zapi_opaque_msg info;
struct ldp_igp_sync_if_state state;
struct ldp_igp_sync_announce announce;
struct zapi_opaque_reg_info dst;
int ret = 0;
s = zclient->ibuf;
@ -2051,6 +2052,13 @@ static int ospf_opaque_msg_handler(ZAPI_CALLBACK_ARGS)
return -1;
switch (info.type) {
case LINK_STATE_SYNC:
STREAM_GETC(s, dst.proto);
STREAM_GETW(s, dst.instance);
STREAM_GETL(s, dst.session_id);
dst.type = LINK_STATE_SYNC;
ret = ospf_te_sync_ted(dst);
break;
case LDP_IGP_SYNC_IF_STATE_UPDATE:
STREAM_GET(&state, s, sizeof(state));
ret = ospf_ldp_sync_state_update(state);

View File

@ -55,6 +55,9 @@ struct sharp_global {
/* The list of nexthops that we are watching and data about them */
struct list *nhs;
/* Traffic Engineering Database */
struct ls_ted *ted;
};
extern struct sharp_global sg;

View File

@ -43,6 +43,7 @@
#include "libfrr.h"
#include "routemap.h"
#include "nexthop_group.h"
#include "link_state.h"
#include "sharp_zebra.h"
#include "sharp_vty.h"
@ -138,6 +139,7 @@ static void sharp_global_init(void)
{
memset(&sg, 0, sizeof(sg));
sg.nhs = list_new();
sg.ted = NULL;
}
static void sharp_start_configuration(void)

View File

@ -29,6 +29,7 @@
#include "vrf.h"
#include "zclient.h"
#include "nexthop_group.h"
#include "link_state.h"
#include "sharpd/sharp_globals.h"
#include "sharpd/sharp_zebra.h"
@ -700,6 +701,142 @@ DEFPY (neigh_discover,
return CMD_SUCCESS;
}
DEFPY (import_te,
import_te_cmd,
"sharp import-te",
SHARP_STR
"Import Traffic Engineering\n")
{
sg.ted = ls_ted_new(1, "Sharp", 0);
sharp_zebra_register_te();
return CMD_SUCCESS;
}
DEFUN (show_sharp_ted,
show_sharp_ted_cmd,
"show sharp ted [<vertex [A.B.C.D]|edge [A.B.C.D]|subnet [A.B.C.D/M]>] [verbose|json]",
SHOW_STR
SHARP_STR
"Traffic Engineering Database\n"
"MPLS-TE Vertex\n"
"MPLS-TE router ID (as an IP address)\n"
"MPLS-TE Edge\n"
"MPLS-TE Edge ID (as an IP address)\n"
"MPLS-TE Subnet\n"
"MPLS-TE Subnet ID (as an IP prefix)\n"
"Verbose output\n"
JSON_STR)
{
int idx = 0;
struct in_addr ip_addr;
struct prefix pref;
struct ls_vertex *vertex;
struct ls_edge *edge;
struct ls_subnet *subnet;
uint64_t key;
bool verbose = false;
bool uj = use_json(argc, argv);
json_object *json = NULL;
if (sg.ted == NULL) {
vty_out(vty, "MPLS-TE import is not enabled\n");
return CMD_WARNING;
}
if (uj)
json = json_object_new_object();
if (argv[argc - 1]->arg && strmatch(argv[argc - 1]->text, "verbose"))
verbose = true;
if (argv_find(argv, argc, "vertex", &idx)) {
/* Show Vertex */
if (argv_find(argv, argc, "A.B.C.D", &idx)) {
if (!inet_aton(argv[idx + 1]->arg, &ip_addr)) {
vty_out(vty,
"Specified Router ID %s is invalid\n",
argv[idx + 1]->arg);
return CMD_WARNING_CONFIG_FAILED;
}
/* Get the Vertex from the Link State Database */
key = ((uint64_t)ip_addr.s_addr) & 0xffffffff;
vertex = ls_find_vertex_by_key(sg.ted, key);
if (!vertex) {
vty_out(vty, "No vertex found for ID %pI4\n",
&ip_addr);
return CMD_WARNING;
}
} else
vertex = NULL;
if (vertex)
ls_show_vertex(vertex, vty, json, verbose);
else
ls_show_vertices(sg.ted, vty, json, verbose);
} else if (argv_find(argv, argc, "edge", &idx)) {
/* Show Edge */
if (argv_find(argv, argc, "A.B.C.D", &idx)) {
if (!inet_aton(argv[idx]->arg, &ip_addr)) {
vty_out(vty,
"Specified Edge ID %s is invalid\n",
argv[idx]->arg);
return CMD_WARNING_CONFIG_FAILED;
}
/* Get the Edge from the Link State Database */
key = ((uint64_t)ip_addr.s_addr) & 0xffffffff;
edge = ls_find_edge_by_key(sg.ted, key);
if (!edge) {
vty_out(vty, "No edge found for ID %pI4\n",
&ip_addr);
return CMD_WARNING;
}
} else
edge = NULL;
if (edge)
ls_show_edge(edge, vty, json, verbose);
else
ls_show_edges(sg.ted, vty, json, verbose);
} else if (argv_find(argv, argc, "subnet", &idx)) {
/* Show Subnet */
if (argv_find(argv, argc, "A.B.C.D/M", &idx)) {
if (!str2prefix(argv[idx]->arg, &pref)) {
vty_out(vty, "Invalid prefix format %s\n",
argv[idx]->arg);
return CMD_WARNING_CONFIG_FAILED;
}
/* Get the Subnet from the Link State Database */
subnet = ls_find_subnet(sg.ted, pref);
if (!subnet) {
vty_out(vty, "No subnet found for ID %pFX\n",
&pref);
return CMD_WARNING;
}
} else
subnet = NULL;
if (subnet)
ls_show_subnet(subnet, vty, json, verbose);
else
ls_show_subnets(sg.ted, vty, json, verbose);
} else {
/* Show the complete TED */
ls_show_ted(sg.ted, vty, json, verbose);
}
if (uj) {
vty_out(vty, "%s\n",
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY));
json_object_free(json);
}
return CMD_SUCCESS;
}
void sharp_vty_init(void)
{
install_element(ENABLE_NODE, &install_routes_data_dump_cmd);
@ -718,8 +855,10 @@ void sharp_vty_init(void)
install_element(ENABLE_NODE, &send_opaque_unicast_cmd);
install_element(ENABLE_NODE, &send_opaque_reg_cmd);
install_element(ENABLE_NODE, &neigh_discover_cmd);
install_element(ENABLE_NODE, &import_te_cmd);
install_element(ENABLE_NODE, &show_debugging_sharpd_cmd);
install_element(ENABLE_NODE, &show_sharp_ted_cmd);
return;
}

View File

@ -30,6 +30,7 @@
#include "zclient.h"
#include "nexthop.h"
#include "nexthop_group.h"
#include "link_state.h"
#include "sharp_globals.h"
#include "sharp_nht.h"
@ -769,11 +770,15 @@ int sharp_zclient_delete(uint32_t session_id)
return 0;
}
static const char *const type2txt[] = { "Generic", "Vertex", "Edge", "Subnet" };
static const char *const status2txt[] = { "Unknown", "New", "Update",
"Delete", "Sync", "Orphan"};
/* Handler for opaque messages */
static int sharp_opaque_handler(ZAPI_CALLBACK_ARGS)
{
struct stream *s;
struct zapi_opaque_msg info;
struct ls_element *lse;
s = zclient->ibuf;
@ -783,6 +788,18 @@ static int sharp_opaque_handler(ZAPI_CALLBACK_ARGS)
zlog_debug("%s: [%u] received opaque type %u", __func__,
zclient->session_id, info.type);
if (info.type == LINK_STATE_UPDATE) {
lse = ls_stream2ted(sg.ted, s, false);
if (lse)
zlog_debug(" |- Got %s %s from Link State Database",
status2txt[lse->status],
type2txt[lse->type]);
else
zlog_debug(
"%s: Error to convert Stream into Link State",
__func__);
}
return 0;
}
@ -853,6 +870,16 @@ void sharp_opaque_reg_send(bool is_reg, uint32_t proto, uint32_t instance,
}
/* Link State registration */
void sharp_zebra_register_te(void)
{
/* First register to received Link State Update messages */
zclient_register_opaque(zclient, LINK_STATE_UPDATE);
/* Then, request initial TED with SYNC message */
ls_request_sync(zclient);
}
void sharp_zebra_send_arp(const struct interface *ifp, const struct prefix *p)
{
zclient_send_neigh_discovery_req(zclient, ifp, p);

View File

@ -60,4 +60,7 @@ void sharp_opaque_reg_send(bool is_reg, uint32_t proto, uint32_t instance,
extern void sharp_zebra_send_arp(const struct interface *ifp,
const struct prefix *p);
/* Register Link State Opaque messages */
extern void sharp_zebra_register_te(void);
#endif

View File

View File

@ -0,0 +1,23 @@
!
interface lo
ip ospf area 0.0.0.0
!
interface r1-eth0
ip ospf network point-to-point
ip ospf hello-interval 2
ip ospf dead-interval 10
ip ospf area 0.0.0.0
!
interface r1-eth1
ip ospf network point-to-point
ip ospf hello-interval 2
ip ospf dead-interval 10
ip ospf area 0.0.0.0
!
router ospf
ospf router-id 10.0.255.1
capability opaque
mpls-te on
mpls-te router-address 10.0.255.1
!

View File

@ -0,0 +1,21 @@
!
interface lo
ip address 10.0.255.1/32
!
interface r1-eth0
ip address 10.0.0.1/24
link-params
metric 20
delay 10000
ava-bw 1.25e+08
enable
exit-link-params
!
interface r1-eth1
ip address 10.0.1.1/24
link-params
enable
exit-link-params
!
ip forwarding
!

View File

@ -0,0 +1,34 @@
!
interface lo
ip ospf area 0.0.0.0
!
interface r2-eth0
ip ospf network point-to-point
ip ospf hello-interval 2
ip ospf dead-interval 10
ip ospf area 0.0.0.0
!
interface r2-eth1
ip ospf network point-to-point
ip ospf hello-interval 2
ip ospf dead-interval 10
ip ospf area 0.0.0.0
!
interface r2-eth2
ip ospf network point-to-point
ip ospf area 0.0.0.0
ip ospf hello-interval 2
ip ospf dead-interval 10
!
interface r2-eth3
ip ospf network point-to-point
ip ospf hello-interval 2
ip ospf dead-interval 10
ip ospf area 0.0.0.0
!
router ospf
ospf router-id 10.0.255.2
capability opaque
mpls-te on
mpls-te router-address 10.0.255.2
!

View File

@ -0,0 +1,33 @@
!
interface lo
ip address 10.0.255.2/32
!
interface r2-eth0
ip address 10.0.0.2/24
link-params
enable
exit-link-params
!
interface r2-eth1
ip address 10.0.1.2/24
link-params
enable
exit-link-params
!
interface r2-eth2
ip address 10.0.3.2/24
link-params
enable
exit-link-params
!
interface r2-eth3
ip address 10.0.4.2/24
link-params
metric 30
delay 25000
use-bw 1.25e+8
enable
exit-link-params
!
ip forwarding
!

View File

@ -0,0 +1,24 @@
!
interface lo
ip ospf area 0.0.0.0
!
interface r3-eth0
ip ospf network point-to-point
ip ospf area 0.0.0.0
ip ospf hello-interval 2
ip ospf dead-interval 10
!
interface r3-eth1
ip ospf network point-to-point
ip ospf area 0.0.0.0
ip ospf hello-interval 2
ip ospf dead-interval 10
!
!
router ospf
ospf router-id 10.0.255.3
capability opaque
mpls-te on
mpls-te router-address 10.0.255.3
mpls-te inter-as as
!

View File

@ -0,0 +1,22 @@
!
interface lo
ip address 10.0.255.3/32
!
interface r3-eth0
ip address 10.0.3.1/24
link-params
enable
admin-grp 0x20
exit-link-params
!
interface r3-eth1
ip address 10.0.5.1/24
link-params
enable
metric 10
delay 50000
neighbor 10.0.255.5 as 65535
exit-link-params
!
ip forwarding
!

View File

@ -0,0 +1,22 @@
!
interface lo
ip ospf area 0.0.0.0
!
interface r4-eth0
ip ospf network point-to-point
ip ospf hello-interval 2
ip ospf dead-interval 10
ip ospf area 0.0.0.0
!
!
router ospf
ospf router-id 10.0.255.4
capability opaque
mpls-te on
mpls-te router-address 10.0.255.4
segment-routing on
segment-routing local-block 5000 5999
segment-routing global-block 10000 19999
segment-routing node-msd 12
segment-routing prefix 10.0.255.4/32 index 400 no-php-flag
!

View File

@ -0,0 +1,12 @@
!
interface lo
ip address 10.0.255.4/32
!
interface r4-eth0
ip address 10.0.4.1/24
link-params
enable
exit-link-params
!
ip forwarding
!

View File

@ -0,0 +1,577 @@
{
"ted":{
"name":"OSPF",
"key":1,
"verticesCount":5,
"edgesCount":9,
"subnetsCount":14,
"vertices":[
{
"vertex-id":167837441,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.1",
"vertex-type":"Standard"
},
{
"vertex-id":167837442,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.2",
"vertex-type":"Standard"
},
{
"vertex-id":167837443,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.3",
"vertex-type":"ASBR"
},
{
"vertex-id":167837444,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.4",
"vertex-type":"Standard",
"segment-routing":{
"srgb-size":10000,
"srgb-lower":10000,
"algorithms":[
{
"0":"SPF"
}
],
"srlb-size":1000,
"srlb-lower":5000,
"msd":12
}
},
{
"vertex-id":167837445,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.5",
"vertex-type":"Remote ASBR",
"asn":65535
}
],
"edges":[
{
"edge-id":167772161,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"local-vertex-id":167837441,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":20,
"local-address":"10.0.0.1",
"remote-address":"10.0.0.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
],
"delay":10000,
"available-bandwidth":125000000.0
}
},
{
"edge-id":167772162,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837441,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.0.2",
"remote-address":"10.0.0.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
}
},
{
"edge-id":167772417,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"local-vertex-id":167837441,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.1.1",
"remote-address":"10.0.1.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
}
},
{
"edge-id":167772418,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837441,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.1.2",
"remote-address":"10.0.1.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
}
},
{
"edge-id":167772929,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"local-vertex-id":167837443,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":0,
"admin-group":32,
"local-address":"10.0.3.1",
"remote-address":"10.0.3.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
}
},
{
"edge-id":167772930,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837443,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.3.2",
"remote-address":"10.0.3.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
}
},
{
"edge-id":167773185,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.4",
"local-vertex-id":167837444,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.4.1",
"remote-address":"10.0.4.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
},
"segment-routing":[
{
"adj-sid":5001,
"flags":"0x60",
"weight":0
},
{
"adj-sid":5000,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167773186,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837444,
"metric":10,
"edge-attributes":{
"te-metric":30,
"local-address":"10.0.4.2",
"remote-address":"10.0.4.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
],
"delay":25000,
"utilized-bandwidth":125000000.0
}
},
{
"edge-id":167773441,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"local-vertex-id":167837443,
"remote-vertex-id":167837445,
"metric":0,
"edge-attributes":{
"te-metric":10,
"local-address":"10.0.5.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
],
"remote-asn":65535,
"remote-as-address":"10.0.255.5",
"delay":50000
}
}
],
"subnets":[
{
"subnet-id":"10.0.0.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"vertex-id":167837441,
"metric":10
},
{
"subnet-id":"10.0.0.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.1.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"vertex-id":167837441,
"metric":10
},
{
"subnet-id":"10.0.1.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.3.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"vertex-id":167837443,
"metric":10
},
{
"subnet-id":"10.0.3.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.4.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.4",
"vertex-id":167837444,
"metric":10
},
{
"subnet-id":"10.0.4.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.5.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"vertex-id":167837443,
"metric":10
},
{
"subnet-id":"10.0.255.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"vertex-id":167837441,
"metric":0
},
{
"subnet-id":"10.0.255.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":0
},
{
"subnet-id":"10.0.255.3\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"vertex-id":167837443,
"metric":0
},
{
"subnet-id":"10.0.255.4\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.4",
"vertex-id":167837444,
"metric":0,
"segment-routing":{
"pref-sid":400,
"algo":0,
"flags":"0x40"
}
},
{
"subnet-id":"10.0.255.5\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.5",
"vertex-id":167837445,
"metric":10
}
]
}
}

View File

@ -0,0 +1,477 @@
{
"ted":{
"name":"OSPF",
"key":1,
"verticesCount":5,
"edgesCount":7,
"subnetsCount":12,
"vertices":[
{
"vertex-id":167837441,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.1",
"vertex-type":"Standard"
},
{
"vertex-id":167837442,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.2",
"vertex-type":"Standard"
},
{
"vertex-id":167837443,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.3",
"vertex-type":"ASBR"
},
{
"vertex-id":167837444,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.4",
"vertex-type":"Standard",
"segment-routing":{
"srgb-size":10000,
"srgb-lower":10000,
"algorithms":[
{
"0":"SPF"
}
],
"srlb-size":1000,
"srlb-lower":5000,
"msd":12
}
},
{
"vertex-id":167837445,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.5",
"vertex-type":"Remote ASBR",
"asn":65535
}
],
"edges":[
{
"edge-id":167772161,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"local-vertex-id":167837441,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":20,
"local-address":"10.0.0.1",
"remote-address":"10.0.0.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
],
"delay":10000,
"available-bandwidth":125000000.0
}
},
{
"edge-id":167772162,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837441,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.0.2",
"remote-address":"10.0.0.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
}
},
{
"edge-id":167772929,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"local-vertex-id":167837443,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":0,
"admin-group":32,
"local-address":"10.0.3.1",
"remote-address":"10.0.3.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
}
},
{
"edge-id":167772930,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837443,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.3.2",
"remote-address":"10.0.3.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
}
},
{
"edge-id":167773185,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.4",
"local-vertex-id":167837444,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.4.1",
"remote-address":"10.0.4.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
},
"segment-routing":[
{
"adj-sid":5001,
"flags":"0x60",
"weight":0
},
{
"adj-sid":5000,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167773186,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837444,
"metric":10,
"edge-attributes":{
"te-metric":30,
"local-address":"10.0.4.2",
"remote-address":"10.0.4.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
],
"delay":25000,
"utilized-bandwidth":125000000.0
}
},
{
"edge-id":167773441,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"local-vertex-id":167837443,
"remote-vertex-id":167837445,
"metric":0,
"edge-attributes":{
"te-metric":10,
"local-address":"10.0.5.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
],
"remote-asn":65535,
"remote-as-address":"10.0.255.5",
"delay":50000
}
}
],
"subnets":[
{
"subnet-id":"10.0.0.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"vertex-id":167837441,
"metric":10
},
{
"subnet-id":"10.0.0.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.3.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"vertex-id":167837443,
"metric":10
},
{
"subnet-id":"10.0.3.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.4.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.4",
"vertex-id":167837444,
"metric":10
},
{
"subnet-id":"10.0.4.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.5.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"vertex-id":167837443,
"metric":10
},
{
"subnet-id":"10.0.255.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"vertex-id":167837441,
"metric":0
},
{
"subnet-id":"10.0.255.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":0
},
{
"subnet-id":"10.0.255.3\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"vertex-id":167837443,
"metric":0
},
{
"subnet-id":"10.0.255.4\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.4",
"vertex-id":167837444,
"metric":0,
"segment-routing":{
"pref-sid":400,
"algo":0,
"flags":"0x40"
}
},
{
"subnet-id":"10.0.255.5\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.5",
"vertex-id":167837445,
"metric":10
}
]
}
}

View File

@ -0,0 +1,409 @@
{
"ted":{
"name":"OSPF",
"key":1,
"verticesCount":4,
"edgesCount":6,
"subnetsCount":10,
"vertices":[
{
"vertex-id":167837441,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.1",
"vertex-type":"Standard"
},
{
"vertex-id":167837442,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.2",
"vertex-type":"Standard"
},
{
"vertex-id":167837443,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.3",
"vertex-type":"ASBR"
},
{
"vertex-id":167837444,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.4",
"vertex-type":"Standard",
"segment-routing":{
"srgb-size":10000,
"srgb-lower":10000,
"algorithms":[
{
"0":"SPF"
}
],
"srlb-size":1000,
"srlb-lower":5000,
"msd":12
}
}
],
"edges":[
{
"edge-id":167772161,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"local-vertex-id":167837441,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":20,
"local-address":"10.0.0.1",
"remote-address":"10.0.0.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
],
"delay":10000,
"available-bandwidth":125000000.0
}
},
{
"edge-id":167772162,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837441,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.0.2",
"remote-address":"10.0.0.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
}
},
{
"edge-id":167772929,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"local-vertex-id":167837443,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":0,
"admin-group":32,
"local-address":"10.0.3.1",
"remote-address":"10.0.3.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
}
},
{
"edge-id":167772930,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837443,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.3.2",
"remote-address":"10.0.3.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
}
},
{
"edge-id":167773185,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.4",
"local-vertex-id":167837444,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.4.1",
"remote-address":"10.0.4.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
},
"segment-routing":[
{
"adj-sid":5001,
"flags":"0x60",
"weight":0
},
{
"adj-sid":5000,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167773186,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837444,
"metric":10,
"edge-attributes":{
"te-metric":30,
"local-address":"10.0.4.2",
"remote-address":"10.0.4.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
],
"delay":25000,
"utilized-bandwidth":125000000.0
}
}
],
"subnets":[
{
"subnet-id":"10.0.0.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"vertex-id":167837441,
"metric":10
},
{
"subnet-id":"10.0.0.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.3.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"vertex-id":167837443,
"metric":10
},
{
"subnet-id":"10.0.3.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.4.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.4",
"vertex-id":167837444,
"metric":10
},
{
"subnet-id":"10.0.4.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.255.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"vertex-id":167837441,
"metric":0
},
{
"subnet-id":"10.0.255.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":0
},
{
"subnet-id":"10.0.255.3\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"vertex-id":167837443,
"metric":0
},
{
"subnet-id":"10.0.255.4\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.4",
"vertex-id":167837444,
"metric":0,
"segment-routing":{
"pref-sid":400,
"algo":0,
"flags":"0x40"
}
}
]
}
}

View File

@ -0,0 +1,490 @@
{
"ted":{
"name":"OSPF",
"key":1,
"verticesCount":4,
"edgesCount":6,
"subnetsCount":10,
"vertices":[
{
"vertex-id":167837441,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.1",
"vertex-type":"Standard",
"segment-routing":{
"srgb-size":4000,
"srgb-lower":20000,
"algorithms":[
{
"0":"SPF"
}
],
"srlb-size":1000,
"srlb-lower":15000
}
},
{
"vertex-id":167837442,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.2",
"vertex-type":"Standard",
"segment-routing":{
"srgb-size":8000,
"srgb-lower":16000,
"algorithms":[
{
"0":"SPF"
}
],
"srlb-size":2000,
"srlb-lower":5000,
"msd":16
}
},
{
"vertex-id":167837443,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.3",
"vertex-type":"ASBR"
},
{
"vertex-id":167837444,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.4",
"vertex-type":"Standard",
"segment-routing":{
"srgb-size":10000,
"srgb-lower":10000,
"algorithms":[
{
"0":"SPF"
}
],
"srlb-size":1000,
"srlb-lower":5000,
"msd":12
}
}
],
"edges":[
{
"edge-id":167772161,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"local-vertex-id":167837441,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":20,
"local-address":"10.0.0.1",
"remote-address":"10.0.0.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
],
"delay":10000,
"available-bandwidth":125000000.0
},
"segment-routing":[
{
"adj-sid":15001,
"flags":"0x60",
"weight":0
},
{
"adj-sid":15000,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167772162,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837441,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.0.2",
"remote-address":"10.0.0.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
},
"segment-routing":[
{
"adj-sid":5001,
"flags":"0x60",
"weight":0
},
{
"adj-sid":5000,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167772929,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"local-vertex-id":167837443,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":0,
"admin-group":32,
"local-address":"10.0.3.1",
"remote-address":"10.0.3.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
}
},
{
"edge-id":167772930,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837443,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.3.2",
"remote-address":"10.0.3.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
},
"segment-routing":[
{
"adj-sid":5003,
"flags":"0x60",
"weight":0
},
{
"adj-sid":5002,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167773185,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.4",
"local-vertex-id":167837444,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.4.1",
"remote-address":"10.0.4.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
},
"segment-routing":[
{
"adj-sid":5001,
"flags":"0x60",
"weight":0
},
{
"adj-sid":5000,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167773186,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837444,
"metric":10,
"edge-attributes":{
"te-metric":30,
"local-address":"10.0.4.2",
"remote-address":"10.0.4.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
],
"delay":25000,
"utilized-bandwidth":125000000.0
},
"segment-routing":[
{
"adj-sid":5005,
"flags":"0x60",
"weight":0
},
{
"adj-sid":5004,
"flags":"0xe0",
"weight":0
}
]
}
],
"subnets":[
{
"subnet-id":"10.0.0.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"vertex-id":167837441,
"metric":10
},
{
"subnet-id":"10.0.0.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.3.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"vertex-id":167837443,
"metric":10
},
{
"subnet-id":"10.0.3.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.4.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.4",
"vertex-id":167837444,
"metric":10
},
{
"subnet-id":"10.0.4.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.255.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"vertex-id":167837441,
"metric":0,
"segment-routing":{
"pref-sid":10,
"algo":0,
"flags":"0x0"
}
},
{
"subnet-id":"10.0.255.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":0,
"segment-routing":{
"pref-sid":20,
"algo":0,
"flags":"0x50"
}
},
{
"subnet-id":"10.0.255.3\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"vertex-id":167837443,
"metric":0
},
{
"subnet-id":"10.0.255.4\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.4",
"vertex-id":167837444,
"metric":0,
"segment-routing":{
"pref-sid":400,
"algo":0,
"flags":"0x40"
}
}
]
}
}

View File

@ -0,0 +1,614 @@
{
"ted":{
"name":"OSPF",
"key":1,
"verticesCount":4,
"edgesCount":8,
"subnetsCount":12,
"vertices":[
{
"vertex-id":167837441,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.1",
"vertex-type":"Standard",
"segment-routing":{
"srgb-size":4000,
"srgb-lower":20000,
"algorithms":[
{
"0":"SPF"
}
],
"srlb-size":1000,
"srlb-lower":15000
}
},
{
"vertex-id":167837442,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.2",
"vertex-type":"Standard",
"segment-routing":{
"srgb-size":8000,
"srgb-lower":16000,
"algorithms":[
{
"0":"SPF"
}
],
"srlb-size":2000,
"srlb-lower":5000,
"msd":16
}
},
{
"vertex-id":167837443,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.3",
"vertex-type":"ASBR"
},
{
"vertex-id":167837444,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.4",
"vertex-type":"Standard",
"segment-routing":{
"srgb-size":10000,
"srgb-lower":10000,
"algorithms":[
{
"0":"SPF"
}
],
"srlb-size":1000,
"srlb-lower":5000,
"msd":12
}
}
],
"edges":[
{
"edge-id":167772161,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"local-vertex-id":167837441,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":20,
"local-address":"10.0.0.1",
"remote-address":"10.0.0.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
],
"delay":10000,
"available-bandwidth":125000000.0
},
"segment-routing":[
{
"adj-sid":15001,
"flags":"0x60",
"weight":0
},
{
"adj-sid":15000,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167772162,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837441,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.0.2",
"remote-address":"10.0.0.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
},
"segment-routing":[
{
"adj-sid":5001,
"flags":"0x60",
"weight":0
},
{
"adj-sid":5000,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167772417,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"local-vertex-id":167837441,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.1.1",
"remote-address":"10.0.1.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
},
"segment-routing":[
{
"adj-sid":15003,
"flags":"0x60",
"weight":0
},
{
"adj-sid":15002,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167772418,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837441,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.1.2",
"remote-address":"10.0.1.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
},
"segment-routing":[
{
"adj-sid":5007,
"flags":"0x60",
"weight":0
},
{
"adj-sid":5006,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167772929,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"local-vertex-id":167837443,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":0,
"admin-group":32,
"local-address":"10.0.3.1",
"remote-address":"10.0.3.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
}
},
{
"edge-id":167772930,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837443,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.3.2",
"remote-address":"10.0.3.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
},
"segment-routing":[
{
"adj-sid":5003,
"flags":"0x60",
"weight":0
},
{
"adj-sid":5002,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167773185,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.4",
"local-vertex-id":167837444,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.4.1",
"remote-address":"10.0.4.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
},
"segment-routing":[
{
"adj-sid":5001,
"flags":"0x60",
"weight":0
},
{
"adj-sid":5000,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167773186,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837444,
"metric":10,
"edge-attributes":{
"te-metric":30,
"local-address":"10.0.4.2",
"remote-address":"10.0.4.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
],
"delay":25000,
"utilized-bandwidth":125000000.0
},
"segment-routing":[
{
"adj-sid":5005,
"flags":"0x60",
"weight":0
},
{
"adj-sid":5004,
"flags":"0xe0",
"weight":0
}
]
}
],
"subnets":[
{
"subnet-id":"10.0.0.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"vertex-id":167837441,
"metric":10
},
{
"subnet-id":"10.0.0.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.1.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"vertex-id":167837441,
"metric":10
},
{
"subnet-id":"10.0.1.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.3.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"vertex-id":167837443,
"metric":10
},
{
"subnet-id":"10.0.3.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.4.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.4",
"vertex-id":167837444,
"metric":10
},
{
"subnet-id":"10.0.4.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.255.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"vertex-id":167837441,
"metric":0,
"segment-routing":{
"pref-sid":10,
"algo":0,
"flags":"0x0"
}
},
{
"subnet-id":"10.0.255.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":0,
"segment-routing":{
"pref-sid":20,
"algo":0,
"flags":"0x50"
}
},
{
"subnet-id":"10.0.255.3\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"vertex-id":167837443,
"metric":0
},
{
"subnet-id":"10.0.255.4\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.4",
"vertex-id":167837444,
"metric":0,
"segment-routing":{
"pref-sid":400,
"algo":0,
"flags":"0x40"
}
}
]
}
}

View File

@ -0,0 +1,615 @@
{
"ted":{
"name":"OSPF",
"key":1,
"verticesCount":4,
"edgesCount":8,
"subnetsCount":12,
"vertices":[
{
"vertex-id":167837441,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.1",
"vertex-type":"Standard",
"segment-routing":{
"srgb-size":4000,
"srgb-lower":20000,
"algorithms":[
{
"0":"SPF"
}
],
"srlb-size":1000,
"srlb-lower":15000
}
},
{
"vertex-id":167837442,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.2",
"vertex-type":"Standard",
"segment-routing":{
"srgb-size":8000,
"srgb-lower":16000,
"algorithms":[
{
"0":"SPF"
}
],
"srlb-size":2000,
"srlb-lower":5000,
"msd":16
}
},
{
"vertex-id":167837443,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.3",
"vertex-type":"ASBR"
},
{
"vertex-id":167837444,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.4",
"vertex-type":"Standard",
"segment-routing":{
"srgb-size":10000,
"srgb-lower":10000,
"algorithms":[
{
"0":"SPF"
}
],
"srlb-size":1000,
"srlb-lower":5000,
"msd":12
}
}
],
"edges":[
{
"edge-id":167772161,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"local-vertex-id":167837441,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":20,
"local-address":"10.0.0.1",
"remote-address":"10.0.0.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
],
"delay":10000,
"available-bandwidth":125000000.0
},
"segment-routing":[
{
"adj-sid":15001,
"flags":"0x60",
"weight":0
},
{
"adj-sid":15000,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167772162,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837441,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.0.2",
"remote-address":"10.0.0.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
},
"segment-routing":[
{
"adj-sid":5001,
"flags":"0x60",
"weight":0
},
{
"adj-sid":5000,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167772417,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"local-vertex-id":167837441,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.1.1",
"remote-address":"10.0.1.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
},
"segment-routing":[
{
"adj-sid":15003,
"flags":"0x60",
"weight":0
},
{
"adj-sid":15002,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167772418,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837441,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.1.2",
"remote-address":"10.0.1.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
},
"segment-routing":[
{
"adj-sid":5007,
"flags":"0x60",
"weight":0
},
{
"adj-sid":5006,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167772929,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"local-vertex-id":167837443,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":0,
"admin-group":32,
"local-address":"10.0.3.1",
"remote-address":"10.0.3.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
}
},
{
"edge-id":167772930,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837443,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.3.2",
"remote-address":"10.0.3.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
},
"segment-routing":[
{
"adj-sid":5003,
"flags":"0x60",
"weight":0
},
{
"adj-sid":5002,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167773185,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.4",
"local-vertex-id":167837444,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.4.1",
"remote-address":"10.0.4.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
],
"delay":20000,
"jitter":10000
},
"segment-routing":[
{
"adj-sid":5001,
"flags":"0x60",
"weight":0
},
{
"adj-sid":5000,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167773186,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837444,
"metric":10,
"edge-attributes":{
"te-metric":30,
"local-address":"10.0.4.2",
"remote-address":"10.0.4.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
],
"delay":25000
},
"segment-routing":[
{
"adj-sid":5005,
"flags":"0x60",
"weight":0
},
{
"adj-sid":5004,
"flags":"0xe0",
"weight":0
}
]
}
],
"subnets":[
{
"subnet-id":"10.0.0.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"vertex-id":167837441,
"metric":10
},
{
"subnet-id":"10.0.0.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.1.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"vertex-id":167837441,
"metric":10
},
{
"subnet-id":"10.0.1.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.3.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"vertex-id":167837443,
"metric":10
},
{
"subnet-id":"10.0.3.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.4.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.4",
"vertex-id":167837444,
"metric":10
},
{
"subnet-id":"10.0.4.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.255.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"vertex-id":167837441,
"metric":0,
"segment-routing":{
"pref-sid":10,
"algo":0,
"flags":"0x0"
}
},
{
"subnet-id":"10.0.255.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":0,
"segment-routing":{
"pref-sid":20,
"algo":0,
"flags":"0x50"
}
},
{
"subnet-id":"10.0.255.3\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"vertex-id":167837443,
"metric":0
},
{
"subnet-id":"10.0.255.4\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.4",
"vertex-id":167837444,
"metric":0,
"segment-routing":{
"pref-sid":400,
"algo":0,
"flags":"0x40"
}
}
]
}
}

View File

@ -0,0 +1,456 @@
{
"ted":{
"name":"OSPF",
"key":1,
"verticesCount":3,
"edgesCount":6,
"subnetsCount":9,
"vertices":[
{
"vertex-id":167837441,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.1",
"vertex-type":"Standard",
"segment-routing":{
"srgb-size":4000,
"srgb-lower":20000,
"algorithms":[
{
"0":"SPF"
}
],
"srlb-size":1000,
"srlb-lower":15000
}
},
{
"vertex-id":167837442,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.2",
"vertex-type":"Standard",
"segment-routing":{
"srgb-size":8000,
"srgb-lower":16000,
"algorithms":[
{
"0":"SPF"
}
],
"srlb-size":2000,
"srlb-lower":5000,
"msd":16
}
},
{
"vertex-id":167837443,
"status":"Sync",
"origin":"OSPFv2",
"router-id":"10.0.255.3",
"vertex-type":"ASBR"
}
],
"edges":[
{
"edge-id":167772161,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"local-vertex-id":167837441,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":20,
"local-address":"10.0.0.1",
"remote-address":"10.0.0.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
],
"delay":10000,
"available-bandwidth":125000000.0
},
"segment-routing":[
{
"adj-sid":15001,
"flags":"0x60",
"weight":0
},
{
"adj-sid":15000,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167772162,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837441,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.0.2",
"remote-address":"10.0.0.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
},
"segment-routing":[
{
"adj-sid":5001,
"flags":"0x60",
"weight":0
},
{
"adj-sid":5000,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167772417,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"local-vertex-id":167837441,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.1.1",
"remote-address":"10.0.1.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
},
"segment-routing":[
{
"adj-sid":15003,
"flags":"0x60",
"weight":0
},
{
"adj-sid":15002,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167772418,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837441,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.1.2",
"remote-address":"10.0.1.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
},
"segment-routing":[
{
"adj-sid":5007,
"flags":"0x60",
"weight":0
},
{
"adj-sid":5006,
"flags":"0xe0",
"weight":0
}
]
},
{
"edge-id":167772929,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"local-vertex-id":167837443,
"remote-vertex-id":167837442,
"metric":10,
"edge-attributes":{
"te-metric":0,
"admin-group":32,
"local-address":"10.0.3.1",
"remote-address":"10.0.3.2",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
}
},
{
"edge-id":167772930,
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"local-vertex-id":167837442,
"remote-vertex-id":167837443,
"metric":10,
"edge-attributes":{
"te-metric":0,
"local-address":"10.0.3.2",
"remote-address":"10.0.3.1",
"max-link-bandwidth":176258176.0,
"max-resv-link-bandwidth":176258176.0,
"unreserved-bandwidth":[
{
"class-type-0":176258176.0
},
{
"class-type-1":176258176.0
},
{
"class-type-2":176258176.0
},
{
"class-type-3":176258176.0
},
{
"class-type-4":176258176.0
},
{
"class-type-5":176258176.0
},
{
"class-type-6":176258176.0
},
{
"class-type-7":176258176.0
}
]
},
"segment-routing":[
{
"adj-sid":5003,
"flags":"0x60",
"weight":0
},
{
"adj-sid":5002,
"flags":"0xe0",
"weight":0
}
]
}
],
"subnets":[
{
"subnet-id":"10.0.0.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"vertex-id":167837441,
"metric":10
},
{
"subnet-id":"10.0.0.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.1.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"vertex-id":167837441,
"metric":10
},
{
"subnet-id":"10.0.1.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.3.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"vertex-id":167837443,
"metric":10
},
{
"subnet-id":"10.0.3.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":10
},
{
"subnet-id":"10.0.255.1\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.1",
"vertex-id":167837441,
"metric":0,
"segment-routing":{
"pref-sid":10,
"algo":0,
"flags":"0x0"
}
},
{
"subnet-id":"10.0.255.2\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.2",
"vertex-id":167837442,
"metric":0,
"segment-routing":{
"pref-sid":20,
"algo":0,
"flags":"0x50"
}
},
{
"subnet-id":"10.0.255.3\/32",
"status":"Sync",
"origin":"OSPFv2",
"advertised-router":"10.0.255.3",
"vertex-id":167837443,
"metric":0
}
]
}
}

View File

@ -0,0 +1,314 @@
#!/usr/bin/env python
#
# test_ospf_te_topo1.py
# Part of NetDEF Topology Tests
#
# Copyright (c) 2021 by Orange
# Author: Olivier Dugeon <olivier.dugeon@orange.com>
#
# Permission to use, copy, modify, and/or distribute this software
# for any purpose with or without fee is hereby granted, provided
# that the above copyright notice and this permission notice appear
# in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
#
"""
test_ospf_te_topo1.py: Test the FRR OSPF with Traffic Engineering.
+------------+
| |
| R1 |
| 10.0.225.1 |
| |
+------------+
r1-eth0| |r1-eth1
| |
10.0.0.0/24| |10.0.1.0/24
| |
r2-eth0| |r2-eth1
+------------+ +------------+
| | | |
| R2 |r2-eth2 r3-eth0| R3 |
| 10.0.255.2 +------------------+ 10.0.255.3 |
| | 10.0.3.0/24 | |
+------------+ +------+-----+
r2-eth3| r3-eth1|
| |
10.0.4.0/24| 10.0.5.0/24|
| |
r4-eth0| V
+------------+ ASBR 10.0.255.5
| |
| R4 |
| 10.0.255.4 |
| |
+------------+
"""
import os
import sys
import json
from functools import partial
# Save the Current Working Directory to find configuration files.
CWD = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(CWD, "../"))
# pylint: disable=C0413
# Required to instantiate the topology builder class.
from mininet.topo import Topo
# Import topogen and topotest helpers
from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger
# and Finally pytest
import pytest
pytestmark = [pytest.mark.ospfd]
class OspfTeTopo(Topo):
"Test topology builder"
def build(self):
"Build function"
tgen = get_topogen(self)
# Create 4 routers
for routern in range(1, 5):
tgen.add_router("r{}".format(routern))
# Interconect router 1 and 2 with 2 links
switch = tgen.add_switch("s1")
switch.add_link(tgen.gears["r1"])
switch.add_link(tgen.gears["r2"])
switch = tgen.add_switch("s2")
switch.add_link(tgen.gears["r1"])
switch.add_link(tgen.gears["r2"])
# Interconect router 3 and 2
switch = tgen.add_switch("s3")
switch.add_link(tgen.gears["r3"])
switch.add_link(tgen.gears["r2"])
# Interconect router 4 and 2
switch = tgen.add_switch("s4")
switch.add_link(tgen.gears["r4"])
switch.add_link(tgen.gears["r2"])
# Interconnect router 3 with next AS
switch = tgen.add_switch("s5")
switch.add_link(tgen.gears["r3"])
def setup_module(mod):
"Sets up the pytest environment"
logger.info("\n\n---- Starting OSPF TE tests ----\n")
tgen = Topogen(OspfTeTopo, mod.__name__)
tgen.start_topology()
router_list = tgen.routers()
for rname, router in router_list.items():
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
router.load_config(
TopoRouter.RD_OSPF, os.path.join(CWD, "{}/ospfd.conf".format(rname))
)
# Initialize all routers.
tgen.start_router()
def teardown_module():
"Teardown the pytest environment"
tgen = get_topogen()
tgen.stop_topology()
logger.info("\n\n---- OSPF TE tests End ----\n")
def compare_ted_json_output(tgen, rname, fileref):
"Compare TED JSON output"
logger.info('Comparing router "%s" TED output', rname)
filename = "{}/reference/{}".format(CWD, fileref)
expected = json.loads(open(filename).read())
command = "show ip ospf mpls-te database json"
# Run test function until we get an result. Wait at most 60 seconds.
test_func = partial(topotest.router_json_cmp, tgen.gears[rname], command, expected)
_, diff = topotest.run_and_expect(test_func, None, count=60, wait=2)
assertmsg = '"{}" TED JSON output mismatches the expected result'.format(rname)
assert diff is None, assertmsg
def setup_testcase(msg):
"Setup test case"
logger.info(msg)
tgen = get_topogen()
# Skip if previous fatal error condition is raised
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
return tgen
# Note that all routers must discover the same Network Topology, so the same TED.
def test_step1():
"Step1: Check initial topology"
tgen = setup_testcase("Step1: test initial OSPF TE Data Base")
for rname in ["r1", "r2", "r3", "r4"]:
compare_ted_json_output(tgen, rname, "ted_step1.json")
def test_step2():
"Step2: Shutdown interface between r1 and r2 and verify that \
corresponding Edges are removed from the TED on all routers "
tgen = setup_testcase("Step2: Shutdown interface between r1 & r2")
tgen.net["r1"].cmd(
'vtysh -c "conf t" -c "interface r1-eth1" -c "shutdown"'
)
tgen.net["r2"].cmd(
'vtysh -c "conf t" -c "interface r2-eth1" -c "shutdown"'
)
for rname in ["r1", "r2", "r3", "r4"]:
compare_ted_json_output(tgen, rname, "ted_step2.json")
def test_step3():
"Step3: Disable Inter-AS on r3 and verify that corresponding Edge and \
remote ASBR are removed from the TED on all routers"
tgen = setup_testcase("Step3: Disable Inter-AS on r3")
tgen.net["r3"].cmd(
'vtysh -c "conf t" -c "router ospf" -c "no mpls-te inter-as"'
)
for rname in ["r1", "r2", "r3", "r4"]:
compare_ted_json_output(tgen, rname, "ted_step3.json")
def test_step4():
"Step4: Enable Segment Routing on r1 and r2 and verify that corresponding \
Edges are updated with Adjacency SID and Subnets with Prefix SID in the \
TED on all routers"
tgen = setup_testcase("Step4: Enable Segment Routing on r1 & r2")
tgen.net["r1"].cmd(
'vtysh -c "conf t" -c "router ospf" -c "segment-routing on"'
)
tgen.net["r1"].cmd(
'vtysh -c "conf t" -c "router ospf" -c "segment-routing global-block 20000 23999"'
)
tgen.net["r1"].cmd(
'vtysh -c "conf t" -c "router ospf" -c "segment-routing prefix 10.0.255.1/32 index 10"'
)
tgen.net["r2"].cmd(
'vtysh -c "conf t" -c "router ospf" -c "segment-routing on"'
)
tgen.net["r2"].cmd(
'vtysh -c "conf t" -c "router ospf" -c "segment-routing node-msd 16"'
)
tgen.net["r2"].cmd(
'vtysh -c "conf t" -c "router ospf" -c "segment-routing local-block 5000 6999"'
)
tgen.net["r2"].cmd(
'vtysh -c "conf t" -c "router ospf" -c "segment-routing prefix 10.0.255.2/32 index 20 explicit-null"'
)
for rname in ["r1", "r2", "r3", "r4"]:
compare_ted_json_output(tgen, rname, "ted_step4.json")
def test_step5():
"Step5: Re-enable interface between r1 & r2 and verify that corresponding \
Edges are added in the TED on all routers"
tgen = setup_testcase("Step5: Re-enable interface between r1 & r2")
tgen.net["r1"].cmd(
'vtysh -c "conf t" -c "interface r1-eth1" -c "no shutdown"'
)
tgen.net["r2"].cmd(
'vtysh -c "conf t" -c "interface r2-eth1" -c "no shutdown"'
)
for rname in ["r1", "r2", "r3", "r4"]:
compare_ted_json_output(tgen, rname, "ted_step5.json")
def test_step6():
"Step6: Set delay and jitter for interface r4-eth0 on r4, remove use-bw \
for interface r2-eth3 on r2 and verify that corresponding Edges are \
updated in the TED on all routers"
tgen = setup_testcase("Step6: Modify link parameters on r2 & r4")
tgen.net["r2"].cmd(
'vtysh -c "conf t" -c "interface r2-eth3" -c "link-params" -c "no use-bw"'
)
tgen.net["r4"].cmd(
'vtysh -c "conf t" -c "interface r4-eth0" -c "link-params" -c "delay 20000"'
)
tgen.net["r4"].cmd(
'vtysh -c "conf t" -c "interface r4-eth0" -c "link-params" -c "delay-variation 10000"'
)
for rname in ["r1", "r2", "r3", "r4"]:
compare_ted_json_output(tgen, rname, "ted_step6.json")
def test_step7():
"Step7: Disable OSPF on r4 and verify that corresponding Vertex, Edges and \
Subnets are removed from the TED on all remaining routers"
tgen = setup_testcase("Step7: Disable OSPF on r4")
tgen.net["r4"].cmd(
'vtysh -c "conf t" -c "no router ospf"'
)
for rname in ["r1", "r2", "r3"]:
compare_ted_json_output(tgen, rname, "ted_step7.json")
def test_memory_leak():
"Run the memory leak test and report results."
tgen = get_topogen()
if not tgen.is_memleak_enabled():
pytest.skip("Memory leak test/report is disabled")
tgen.report_memory_leaks()
if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]
sys.exit(pytest.main(args))