2 # NEPI, a framework to manage network experiments
3 # Copyright (C) 2014 INRIA
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Author: Alina Quereilhac <alina.quereilhac@inria.fr>
20 from nepi.execution.attribute import Attribute, Flags, Types
21 from nepi.execution.resource import clsinit_copy, ResourceState, reschedule_delay
22 from nepi.resources.linux.ns3.ccn.ns3ccndceapplication import LinuxNS3CCNDceApplication
25 class LinuxNS3DceFIBEntry(LinuxNS3CCNDceApplication):
26 _rtype = "ns3::LinuxDceFIBEntry"
29 def _register_attributes(cls):
30 uri = Attribute("uri",
31 "URI prefix to match and route for this FIB entry",
35 protocol = Attribute("protocol",
36 "Transport protocol used in network connection to peer "
37 "for this FIB entry. One of 'udp' or 'tcp'.",
38 type = Types.Enumerate,
40 allowed = ["udp", "tcp"],
43 host = Attribute("host",
44 "Peer hostname used in network connection for this FIB entry. ",
47 port = Attribute("port",
48 "Peer port address used in network connection to peer "
49 "for this FIB entry.",
53 "Peer host public IP used in network connection for this FIB entry. ",
56 cls._register_attribute(uri)
57 cls._register_attribute(protocol)
58 cls._register_attribute(host)
59 cls._register_attribute(port)
60 cls._register_attribute(ip)
62 def _instantiate_object(self):
63 if not self.get("binary"):
64 self.set("binary", "ccndc")
66 if not self.get("arguments"):
67 self.set("arguments", self._arguments)
69 super(LinuxNS3DceFIBEntry, self)._instantiate_object()
76 args.append(self.get("uri"))
77 if self.get("protocol"):
78 args.append(self.get("protocol"))
80 args.append(self.get("host"))
82 args.append(self.get("port"))
84 args.append(self.get("ip"))