From 65eccc239527f13409cc465b47d34358d4e5ae1a Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Tue, 4 Aug 2009 02:26:52 +0000 Subject: [PATCH] added sfa upcalls --- PLC/Methods/AddPersonKey.py | 13 +++++++++---- PLC/Methods/AddSite.py | 10 +++++++--- PLC/Methods/AddSlice.py | 7 +++++-- PLC/Methods/DeletePerson.py | 10 +++++++--- PLC/Methods/DeleteSite.py | 10 +++++++--- PLC/Methods/DeleteSlice.py | 4 ++++ 6 files changed, 39 insertions(+), 15 deletions(-) diff --git a/PLC/Methods/AddPersonKey.py b/PLC/Methods/AddPersonKey.py index cdf0235..3a06a34 100644 --- a/PLC/Methods/AddPersonKey.py +++ b/PLC/Methods/AddPersonKey.py @@ -6,6 +6,7 @@ from PLC.Parameter import Parameter, Mixed from PLC.Keys import Key, Keys from PLC.Persons import Person, Persons from PLC.Auth import Auth +from PLC.SFA import SFA can_update = lambda (field, value): field in ['key_type','key'] @@ -53,9 +54,13 @@ class AddPersonKey(Method): person.add_key(key, commit = True) # Logging variables - self.event_objects = {'Person': [person['person_id']], - 'Key': [key['key_id']]} - self.message = 'Key %d added to person %d' % \ - (key['key_id'], person['person_id']) + self.event_objects = {'Person': [person['person_id']], + 'Key': [key['key_id']]} + self.message = 'Key %d added to person %d' % \ + (key['key_id'], person['person_id']) + # sync with the geni db + sfa = SFA() + sfa.update_record(person, 'person') + return key['key_id'] diff --git a/PLC/Methods/AddSite.py b/PLC/Methods/AddSite.py index b506faa..bda21ce 100644 --- a/PLC/Methods/AddSite.py +++ b/PLC/Methods/AddSite.py @@ -5,6 +5,7 @@ from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.Sites import Site, Sites from PLC.Auth import Auth +from PLC.SFA import SFA can_update = lambda (field, value): field in \ ['name', 'abbreviated_name', 'login_base', @@ -36,8 +37,11 @@ class AddSite(Method): site = Site(self.api, site_fields) site.sync() - # Logging variables - self.event_objects = {'Site': [site['site_id']]} + # Logging variables + self.event_objects = {'Site': [site['site_id']]} self.message = 'Site %d created' % site['site_id'] - return site['site_id'] + sfa = SFA() + sfa.update_record(site, 'site', site['login_base']) + + return site['site_id'] diff --git a/PLC/Methods/AddSlice.py b/PLC/Methods/AddSlice.py index 8dceb6f..78016b3 100644 --- a/PLC/Methods/AddSlice.py +++ b/PLC/Methods/AddSlice.py @@ -14,6 +14,7 @@ from PLC.TagTypes import TagTypes from PLC.SliceTags import SliceTags from PLC.Methods.AddSliceTag import AddSliceTag from PLC.Methods.UpdateSliceTag import UpdateSliceTag +from PLC.SFA import SFA can_update = ['name', 'instantiation', 'url', 'description', 'max_nodes'] @@ -102,7 +103,9 @@ class AddSlice(Method): else: UpdateSliceTag(self.api).__call__(auth,slice_tags[0]['slice_tag_id'],value) - self.event_objects = {'Slice': [slice['slice_id']]} + self.event_objects = {'Slice': [slice['slice_id']]} self.message = "Slice %d created" % slice['slice_id'] - + + sfa = SFA() + sfa.update_record(slice, 'slice', site['login_base']) return slice['slice_id'] diff --git a/PLC/Methods/DeletePerson.py b/PLC/Methods/DeletePerson.py index 893b16e..738850c 100644 --- a/PLC/Methods/DeletePerson.py +++ b/PLC/Methods/DeletePerson.py @@ -5,6 +5,7 @@ from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.Persons import Person, Persons from PLC.Auth import Auth +from PLC.SFA import SFA class DeletePerson(Method): """ @@ -46,8 +47,11 @@ class DeletePerson(Method): person.delete() - # Logging variables - self.event_objects = {'Person': [person['person_id']]} - self.message = 'Person %d deleted' % person['person_id'] + # Logging variables + self.event_objects = {'Person': [person['person_id']]} + self.message = 'Person %d deleted' % person['person_id'] + + sfa = SFA() + sfa.delete_record(person, 'person') return 1 diff --git a/PLC/Methods/DeleteSite.py b/PLC/Methods/DeleteSite.py index 9f3cdf5..1eee12c 100644 --- a/PLC/Methods/DeleteSite.py +++ b/PLC/Methods/DeleteSite.py @@ -8,6 +8,7 @@ from PLC.Persons import Person, Persons from PLC.Nodes import Node, Nodes from PLC.PCUs import PCU, PCUs from PLC.Auth import Auth +from PLC.SFA import SFA class DeleteSite(Method): """ @@ -41,8 +42,11 @@ class DeleteSite(Method): site.delete() - # Logging variables - self.event_objects = {'Site': [site['site_id']]} - self.message = 'Site %d deleted' % site['site_id'] + # Logging variables + self.event_objects = {'Site': [site['site_id']]} + self.message = 'Site %d deleted' % site['site_id'] + sfa = SFA() + sfa.delete_record(site, 'site') + return 1 diff --git a/PLC/Methods/DeleteSlice.py b/PLC/Methods/DeleteSlice.py index d3bc8f4..29840ee 100644 --- a/PLC/Methods/DeleteSlice.py +++ b/PLC/Methods/DeleteSlice.py @@ -5,6 +5,7 @@ from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.Slices import Slice, Slices from PLC.Auth import Auth +from PLC.SFA import SFA class DeleteSlice(Method): """ @@ -47,4 +48,7 @@ class DeleteSlice(Method): slice.delete() self.event_objects = {'Slice': [slice['slice_id']]} + sfa = SFA() + sfa.delete_record(slice, 'slice') + return 1 -- 2.43.0