Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding DataPlaneSpec to the IO-spec #230

Merged
merged 14 commits into from
Oct 18, 2023
72 changes: 72 additions & 0 deletions verification/io/dataplane_abstract.gobra
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright 2022 ETH Zurich
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// +gobra

package io

type DataPlaneSpec adt {
DataPlaneSpec_{
linkTypes dict[IO_ifs]IO_Link
neighborIAs dict[IO_ifs]IO_as
localIA IO_as
topology TopologySpec
}
mlimbeck marked this conversation as resolved.
Show resolved Hide resolved
}

// TopologySpec provides information about the entire network topology.
// coreAS: IDs of the core Autonomous Systems
// links: representation of the network topology as a graph.
// links[a1][1] == a2 means that AS a1 has an edge to AS a2 via interface 1.
type TopologySpec adt {
TopologySpec_{
coreAS set[IO_as]
links dict[IO_as](dict[IO_ifs]IO_as)
}
}

ghost
decreases
pure func (dp DataPlaneSpec) Valid() bool{
return domain(dp.linkTypes) == domain(dp.neighborIAs) &&
dp.localIA in domain(dp.topology.links) &&
dp.neighborIAs == dp.topology.links[dp.localIA] &&
(forall core IO_as :: {core in dp.topology.coreAS} core in dp.topology.coreAS ==> core in domain(dp.topology.links))
}

ghost
decreases
requires ifs in domain(dp.linkTypes)
pure func (dp DataPlaneSpec) GetLinkType(ifs IO_ifs) IO_Link {
return dp.linkTypes[ifs]
}

ghost
requires ifs in domain(dp.neighborIAs)
decreases
pure func (dp DataPlaneSpec) GetNeighborIA(ifs IO_ifs) IO_as {
return dp.neighborIAs[ifs]
}

ghost
decreases
pure func (dp DataPlaneSpec) GetLocalIA() IO_as {
return dp.localIA
}

ghost
decreases
pure func (dp DataPlaneSpec) GetCoreAS() set[IO_as] {
return dp.topology.coreAS
}
Loading