123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384openSyntaxopenFabricGenopenOptimizeopenPrettymoduleTbl=Core.Hashtbl.PolymoduleSexp=Core.SexpmoduleMake(FG:FABRIC_GEN)=structincludeFG(*
Vingress defines the virtual ingress. Examples:
1) The physical ingress is {(1,1)} (i.e. packets can enter the network only
through port 1 of switch 1), and we want packets to enter the virtual network
at vport 3 of vswitch 3. This is encoded as
vingress =
vswitch := 3; vport := 3
2) The physical ingress is {(1,1), (2,2)} (i.e. packets can enter the network only
through port 1 of switch 1 and port 2 of switch 2),
and we want packets to enter the virtual network
at vport 3 of vswitch 3. This is encoded as
vingress =
vswitch := 3; vport := 3
3) The physical ingress is {(1,1)} and we want packets to enter the virtual network
at both vport 3 of vswitch 3 and vport 4 of switch 4. This is encoded as
vingress =
(vswitch := 3; vport := 3) + (vswitch := 4; vport := 4)
4) The physical ingress is {(1,1), (2,2)} and we want packets from (1,1) to
enter the virtual network at vport 3 of vswitch 3, and packet from (2,2)
shall enter at vport 4 of vswitch 4. This is encoded as
vingress =
switch = 1; port = 1; vswitch := 3; vport := 3
+ switch = 2; port = 2; vswitch := 4; vport := 4
5) I just realized that the framework can even handle more complicated virtual ingress
specifications as the ones Arjun mentioned in our last meeting, e.g.
vingress =
IPProto = tcp; vswitch := 1; vport := 1
+ IPProto = ucp; vswitch := 2; vport := 1
This is super awesome!!
To gurantee correctness we will have to do some sort of "type checking", i.e. we have to make sure
certain pre conditions are met.
*)letrecencode_vlinks(vtopo:policy)=matchvtopowith|Union(p,q)->mk_union(encode_vlinksp)(encode_vlinksq)|Seq(p,q)->mk_seq(encode_vlinksp)(encode_vlinksq)|Starp->mk_star(encode_vlinksp)|VLink(vsw1,vpt1,vsw2,vpt2)->mk_seq(mk_filter(mk_and(Test(VSwitchvsw1))(Test(VPortvpt1))))(mk_seq(Mod(VSwitchvsw2))(Mod(VPortvpt2)))|_->vtopoletcompile_with_fabric~(vtopo:policy)~(ving_pol:policy)~(ving:pred)~(veg:pred)~(ping:pred)~(peg:pred)~(vpol:policy)(fabric:FG.fabric):policy=let(fout_set,fin_set)=fabricinletfout=mk_big_unionfout_setinletfin=mk_big_unionfin_setinleting=mk_big_seq[Filterping;ving_pol;Filterving]inleteg=Filter(mk_andvegpeg)inletp=mk_seqvpolfoutinlett=mk_seq(encode_vlinksvtopo)fininmk_big_seq[ing;mk_star(mk_seqpt);p;eg]letcompile?(log=true)?(record_paths:stringoption)~(vrel:pred)~(vtopo:policy)~(ving_pol:policy)~(ving:pred)~(veg:pred)~(ptopo:policy)~(ping:pred)~(peg:pred)(vpol:policy):policy=generate_fabric~log?record_paths~vrel~vtopo~ving~veg~ptopo~ping~peg()|>compile_with_fabric~vtopo~ving_pol~ving~veg~ping~peg~vpolend