Esempio n. 1
0
 def removeUserURN(self):
     if not request.json:
         return
     try:
         objs = self.validate(request.json, [("urn", (unicode, str))])
         u = ConfigDB.getUser(request.environ["USER"])
         AppData.removeUserURN(objs["urn"], u)
         return jsonify(None)
     except JSONValidationError, e:
         jd = e.__json__()
         return jsonify(jd, code=1, msg=jd["exception"])
Esempio n. 2
0
 def removeUserURN (self):
   if not request.json:
     return
   try:
     objs = self.validate(request.json, [("urn", (unicode, str))])
     u = ConfigDB.getUser(request.environ["USER"])
     AppData.removeUserURN(objs["urn"], u)
     return jsonify(None)
   except JSONValidationError, e:
     jd = e.__json__()
     return jsonify(jd, code = 1, msg = jd["exception"])
Esempio n. 3
0
 def listPortGroups(self):
     try:
         groups = AppData.getPortGroups()
         l = [str(x) for x in groups.keys()]
         return jsonify(l)
     except Exception, e:
         self._log.exception("Exception")
         return jsonify(None, code=2, msg=traceback.format_exc())
Esempio n. 4
0
 def listPortGroups (self):
   try:
     groups = AppData.getPortGroups()
     l = [str(x) for x in groups.keys()]
     return jsonify(l)
   except Exception, e:
     self._log.exception("Exception")
     return jsonify(None, code = 2, msg  = traceback.format_exc())
Esempio n. 5
0
 def showPortGroup (self):
   if not request.json:
     return
   try:
     objs = self.validate(request.json, [("group-id", (unicode, str))])
     pg = AppData.getPortGroup(objs["group-id"])
     return jsonify(pg)
   except JSONValidationError, e:
     jd = e.__json__()
     return jsonify(jd, code = 1, msg = jd["exception"])
Esempio n. 6
0
 def showPortGroup(self):
     if not request.json:
         return
     try:
         objs = self.validate(request.json, [("group-id", (unicode, str))])
         pg = AppData.getPortGroup(objs["group-id"])
         return jsonify(pg)
     except JSONValidationError, e:
         jd = e.__json__()
         return jsonify(jd, code=1, msg=jd["exception"])
Esempio n. 7
0
 def createPortGroup(self):
     if not request.json:
         return
     try:
         objs = self.validate(request.json, [("name", (unicode, str)),
                                             ("desc", (unicode, str))])
         u = ConfigDB.getUser(request.environ["USER"])
         pg = AppData.createPortGroup(objs["name"], objs["desc"])
         return jsonify(str(pg.uuid))
     except JSONValidationError, e:
         jd = e.__json__()
         return jsonify(jd, code=1, msg=jd["exception"])
Esempio n. 8
0
 def createPortGroup (self):
   if not request.json:
     return
   try:
     objs = self.validate(request.json, [("name", (unicode, str)),
                                         ("desc", (unicode, str))])
     u = ConfigDB.getUser(request.environ["USER"])
     pg = AppData.createPortGroup(objs["name"], objs["desc"])
     return jsonify(str(pg.uuid))
   except JSONValidationError, e:
     jd = e.__json__()
     return jsonify(jd, code = 1, msg = jd["exception"])
Esempio n. 9
0
 def removePortFromGroup (self):
   if not request.json:
     return
   try:
     objs = self.validate(request.json, [("group-id", (unicode, str)),
                                         ("dpid", (unicode, str)),
                                         ("port-num", (int))])
     pg = AppData.getPortGroup(objs["group-id"])
     pg.removePort(objs["dpid"], objs["port-num"])
     return jsonify(None)
   except JSONValidationError, e:
     jd = e.__json__()
     return jsonify(jd, code = 1, msg = jd["exception"])
Esempio n. 10
0
 def removePortFromGroup(self):
     if not request.json:
         return
     try:
         objs = self.validate(request.json, [("group-id", (unicode, str)),
                                             ("dpid", (unicode, str)),
                                             ("port-num", (int))])
         pg = AppData.getPortGroup(objs["group-id"])
         pg.removePort(objs["dpid"], objs["port-num"])
         return jsonify(None)
     except JSONValidationError, e:
         jd = e.__json__()
         return jsonify(jd, code=1, msg=jd["exception"])
Esempio n. 11
0
 def getMACs(self):
     return jsonify([x for x in AppData.iterMACs()])
Esempio n. 12
0
 def getSubnets (self):
   return jsonify([x for x in AppData.iterSubnets()])
Esempio n. 13
0
 def rebuildDB (self):
   AppData.rebuild()
   return jsonify(None)
Esempio n. 14
0
 def getEthertypes (self):
   return jsonify([x for x in AppData.iterEthertypes()])
Esempio n. 15
0
 def getMACs (self):
   return jsonify([x for x in AppData.iterMACs()])
Esempio n. 16
0
 def getEthertypes(self):
     return jsonify([x for x in AppData.iterEthertypes()])
Esempio n. 17
0
 def getSubnets(self):
     return jsonify([x for x in AppData.iterSubnets()])
Esempio n. 18
0
 def rebuildDB(self):
     AppData.rebuild()
     return jsonify(None)