Open kevin-w-du opened 3 years ago
The problem with these is that a lot of the information are not in the class themself. These API will not be possible unless you want them to available only after render.
Problem with the InternetExchange
and AutonomousSystem
class is that they do not know what ASes are connected to them (at least not before the emulator is rendered, as all peering are stored in the Ebgp
layer)
Networks
, too, do not know what hosts/routers are connected before rendered. There is a getAssociations
to get a list of connected nodes after the render.
Router
do know a list of names of the networks they have connected to before render, but those are just names, not the actual Network
object.
The reason for using names instead of the actual object is to allow connecting to a network that does not exist yet - which can happen when using a component.
Host
also cannot do getServices
before render, but should be possible to add after render.
Returning names is fine.
It seems that adding these APIs is difficult. We will keep this issue open, and see whether we can come up with ideas to do it (maybe in other ways). The goal is to help users get an instance of an object without knowing names.
For example, after loading a base component, I would like to add a host to a network within an AS, but I don't want to be bothered with the name of the network (this name is supposed to be an internal name).
It will be great if we can provide the APIs in each class to allow users to enumerate its direct internal elements. I do see some classes already have such APIs, but not all. These APIs will be very helpful for others to build on top of an existing base-layer component.
getASes()
getNetworks()
: this one already exists. I do see several other usefulget
APIs in this class.getPeers()
: get the peering relationship and the location (IX) of the peering.getHosts()
andgetRouters()
getNetworks()
: get the list of the networks it is attached togetServices()
: not sure whether this is doable after the binding. If not, it is better to leave it out.