Skip to content

Commit

Permalink
routecore Asn
Browse files Browse the repository at this point in the history
  • Loading branch information
density215 committed Dec 21, 2023
1 parent 708775f commit 2ffd151
Show file tree
Hide file tree
Showing 20 changed files with 258 additions and 144 deletions.
3 changes: 2 additions & 1 deletion examples/asn_in_out.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use roto::compiler::Compiler;

use roto::blocks::Scope::{self, FilterMap};
use roto::types::builtin::Asn;
use roto::types::collections::Record;
use roto::types::typedef::TypeDef;
use roto::vm;

use routecore::asn::Asn;

fn test_data(
name: Scope,
source_code: &'static str,
Expand Down
9 changes: 4 additions & 5 deletions examples/eval.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
use roto::compiler::compile::Compiler;

use roto::types::builtin::{
self, Asn, BuiltinTypeValue,
};
use roto::types::builtin::BuiltinTypeValue;
use roto::types::collections::{ElementTypeValue, List, Record};
use roto::types::typedef::TypeDef;
use roto::types::typevalue::TypeValue;
use roto::vm;
use roto::blocks::Scope::{self, FilterMap};

use routecore::bgp::communities::HumanReadableCommunity as Community;
use routecore::asn::Asn;

fn test_data(
name: Scope,
Expand Down Expand Up @@ -70,11 +69,11 @@ fn test_data(
("next-hop", next_hop),
(
"med",
builtin::BuiltinTypeValue::U32(80).into(),
BuiltinTypeValue::U32(80).into(),
),
(
"local-pref",
builtin::BuiltinTypeValue::U32(20).into(),
BuiltinTypeValue::U32(20).into(),
),
("communities", comms),
],
Expand Down
5 changes: 2 additions & 3 deletions examples/types.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use roto::types::builtin::{
Asn, BuiltinTypeValue,
};
use roto::types::builtin::BuiltinTypeValue;
use roto::types::collections::{ElementTypeValue, List, Record};
use roto::types::typedef::TypeDef;
use roto::types::typevalue::TypeValue;

use routecore::bgp::communities::HumanReadableCommunity as Community;
use routecore::asn::Asn;

fn main() {
// let count = RotoType::create_primitive_var(
Expand Down
3 changes: 2 additions & 1 deletion src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ use smallvec::SmallVec;

use routecore::bgp::communities::HumanReadableCommunity as Community;
use routecore::bgp::communities::{ExtendedCommunity, LargeCommunity, StandardCommunity};
use routecore::asn::Asn;

use crate::compiler::error::CompileError;
use crate::types::builtin::{Asn, Boolean};
use crate::types::builtin::Boolean;
use crate::types::typevalue::TypeValue;
use crate::{first_into_compile_err, parse_string};

Expand Down
5 changes: 3 additions & 2 deletions src/attr_change_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ use routecore::bgp::message::nlri::PathId;
use routecore::bgp::types::AfiSafi;
use routecore::addr::Prefix;
use routecore::bgp::communities::HumanReadableCommunity as Community;
use routecore::asn::Asn;
use serde::Serialize;
use std::marker::PhantomData;
use std::ops::Index;

use crate::ast::StringLiteral;
use crate::types::builtin::{
Asn, AtomicAggregate, BuiltinTypeValue, IpAddress,
AtomicAggregate, BuiltinTypeValue, IpAddress,
LocalPref, MultiExitDisc, OriginType, RouteStatus,
};
use crate::types::collections::ElementTypeValue;
Expand Down Expand Up @@ -318,7 +319,7 @@ impl<V: VectorValue + Into<TypeValue> + std::fmt::Debug> VectorOption<V> {
.0
.try_into_asn()
.map_err(|_| LongSegmentError)?;
vec![Asn(asn)]
vec![asn]
}
TypeValue::Builtin(BuiltinTypeValue::U32(int)) => {
vec![Asn::from_u32(int)]
Expand Down
3 changes: 2 additions & 1 deletion src/types/builtin/builtin_type_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use std::fmt::Display;

use routecore::asn::Asn;
use routecore::bgp::message::nlri::PathId;
use routecore::bgp::types::{AfiSafi, NextHop};
use routecore::addr::Prefix;
Expand All @@ -23,7 +24,7 @@ use super::super::typedef::TypeDef;
use super::super::typevalue::TypeValue;

use super::{
Aggregator, Asn, AtomicAggregate, BgpUpdateMessage, Boolean,
Aggregator, AtomicAggregate, BgpUpdateMessage, Boolean,
HexLiteral, Hop, IntegerLiteral, IpAddress, LocalPref,
MultiExitDisc, OriginType, PrefixLength,
RawRouteWithDeltas, RouteStatus, StringLiteral,
Expand Down
Loading

0 comments on commit 2ffd151

Please sign in to comment.