ConfigExpr

Enum ConfigExpr 

Source
pub enum ConfigExpr<P: Prefix> {
    IgpLinkWeight {
        source: RouterId,
        target: RouterId,
        weight: LinkWeight,
    },
    OspfArea {
        source: RouterId,
        target: RouterId,
        area: OspfArea,
    },
    BgpSession {
        source: RouterId,
        target: RouterId,
        target_is_client: bool,
    },
    BgpRouteMap {
        router: RouterId,
        neighbor: RouterId,
        direction: RouteMapDirection,
        map: RouteMap<P>,
    },
    StaticRoute {
        router: RouterId,
        prefix: P,
        target: StaticRoute,
    },
    LoadBalancing {
        router: RouterId,
    },
    AdvertiseRoute {
        router: RouterId,
        prefix: P,
        as_path: Vec<ASN>,
        med: Option<u32>,
        community: BTreeSet<Community>,
    },
}
Expand description

§Single configuration expression

The expression sets a specific thing in the network.

Variants§

§

IgpLinkWeight

Sets the link weight of a single link (directional) TODO make sure that the weight is strictly smaller than infinity.

Fields

§source: RouterId

Source router for link

§target: RouterId

Target router for link

§weight: LinkWeight

Link weight for IGP

§

OspfArea

Set the OSPF area of a single link (bidirectional)

Fields

§source: RouterId

Source router for link

§target: RouterId

Target router for link

§area: OspfArea

Area to set the link to

§

BgpSession

Create a BGP session

Fields

§source: RouterId

Source router for Session

§target: RouterId

Target router for Session

§target_is_client: bool

Whether the target is a route reflector client of the source

§

BgpRouteMap

Set the BGP Route Map

Fields

§router: RouterId

Router to configure the route map

§neighbor: RouterId

Neighbor for which to setup the session

§direction: RouteMapDirection

Direction (incoming or outgoing)

§map: RouteMap<P>

Route Map

§

StaticRoute

Set a static route

Fields

§router: RouterId

On which router set the static route

§prefix: P

For which prefix to set the static route

§target: StaticRoute

To which neighbor to forward packets to.

§

LoadBalancing

Enable or disable load balancing

Fields

§router: RouterId

Router where to enable the load balancing

§

AdvertiseRoute

Advertise (originate) a route for a prefix (network)

Fields

§router: RouterId

The router that advertises (originates) the route

§prefix: P

The prefix (network) to advertise

§as_path: Vec<ASN>

The AS path to advertise. Note, that the router will still prepend its own AS when advertising to external neighbors.

§med: Option<u32>

The MED value that should be advertised.

§community: BTreeSet<Community>

The community value to advertise. Note, that private communities are removed when advertised on eBGP sessions (except those of the receiving AS).

Implementations§

Source§

impl<P: Prefix> ConfigExpr<P>

Source

pub fn key(&self) -> ConfigExprKey<P>

Returns the key of the config expression. The idea behind the key is that the ConfigExpr cannot be hashed and used as a key for a HashMap. But ConfigExprKey implements Hash, and can therefore be used as a key.

Source

pub fn routers(&self) -> Vec<RouterId>

Returns the router IDs on which the configuration is applied and have to be changed.

Trait Implementations§

Source§

impl<P: Clone + Prefix> Clone for ConfigExpr<P>

Source§

fn clone(&self) -> ConfigExpr<P>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<P: Debug + Prefix> Debug for ConfigExpr<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, P> Deserialize<'de> for ConfigExpr<P>
where P: for<'a> Deserialize<'a> + Prefix,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'n, P: Prefix, Q, Ospf: OspfImpl> NetworkFormatter<'n, P, Q, Ospf> for ConfigExpr<P>

Source§

fn fmt(&self, net: &'n Network<P, Q, Ospf>) -> String

Return a formatted string by looking up router IDs in the network.
Source§

fn fmt_multiline(&self, net: &'n Network<P, Q, Ospf>) -> String

Return a multiline struct that can be formatted and displayed. Read more
Source§

fn fmt_multiline_indent( &self, net: &'n Network<P, Q, Ospf>, _indent: usize, ) -> String

Return a multiline struct that can be formatted and displayed. Read more
Source§

impl<P: Prefix + PartialEq> PartialEq for ConfigExpr<P>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<P> Serialize for ConfigExpr<P>
where P: Serialize + Prefix,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<P> Freeze for ConfigExpr<P>
where P: Freeze,

§

impl<P> RefUnwindSafe for ConfigExpr<P>

§

impl<P> Send for ConfigExpr<P>

§

impl<P> Sync for ConfigExpr<P>

§

impl<P> Unpin for ConfigExpr<P>
where P: Unpin, <P as Prefix>::Set: Unpin,

§

impl<P> UnwindSafe for ConfigExpr<P>
where P: UnwindSafe, <P as Prefix>::Set: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,