enforce tags system
[nepi.git] / src / nepi / util / tags.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 MOBILE = "mobile"
5 NODE = "node"
6 INTERFACE = "interface"
7 WIRELESS = "wireless"
8 APPLICATION = "application"
9 NAT = "nat"
10 ROUTER = "router" 
11 SWITCH = "switch"
12 PPP = "point-to-point"
13 PROTOCOL = "protocol"
14 TUNNEL = "tunnel"
15 INTERNET = "internet"
16 HUB = "hub"
17 ALLOW_ADDRESSES = "allow_addresses"
18 ALLOW_ROUTES = "allow_routes"
19 HAS_ADDRESSES = "has_addresses"
20 HAS_ROUTES = "has_routes"
21
22 class Taggable(object):
23     def __init__(self):
24         super(Taggable, self).__init__()
25         self._tags = list()
26
27     @property
28     def tags(self):
29         return self._tags
30
31     def add_tag(self, tag_id):
32         self._tags.append(tag_id)
33
34     def has_tag(self, tag_id):
35         return tag_id in self._tags
36