Line data Source code
1 : /* 2 : * Copyright (c) 2016 Juniper Networks, Inc. All rights reserved. 3 : */ 4 : 5 : #include "cmn/agent.h" 6 : #include "cmn/agent_cmn.h" 7 : #include <sandesh/sandesh_types.h> 8 : #include <sandesh/sandesh.h> 9 : #include "resource_manager/resource_manager.h" 10 : #include "resource_manager/resource_table.h" 11 : #include "resource_manager/resource_cmn.h" 12 : #include "bgp_as_service_index.h" 13 : #include "resource_manager/resource_manager_types.h" 14 : #include "resource_manager/resource_backup.h" 15 : 16 0 : BgpAsServiceIndexResourceKey::BgpAsServiceIndexResourceKey(ResourceManager *rm, 17 0 : const boost::uuids::uuid &uuid):IndexResourceKey(rm, 18 0 : Resource::BGP_AS_SERVICE_INDEX), uuid_(uuid) { 19 : 20 0 : } 21 : 22 0 : void BgpAsServiceIndexResourceKey::Backup(ResourceData *data, uint16_t op){ 23 0 : IndexResourceData *index_data = static_cast<IndexResourceData *>(data); 24 0 : if (op == ResourceBackupReq::DEL) { 25 : rm()->backup_mgr()-> 26 0 : sandesh_maps().DeleteBgpAsServiceResourceEntry(index_data->index()); 27 : } else { 28 0 : BgpAsServiceIndexResource backup_data; 29 0 : backup_data.set_uuid(UuidToString(uuid_)); 30 0 : backup_data.set_time_stamp(UTCTimestampUsec()); 31 : rm()->backup_mgr()-> 32 0 : sandesh_maps().AddBgpAsServiceResourceEntry(index_data->index(), 33 : backup_data); 34 0 : } 35 0 : rm()->backup_mgr()->sandesh_maps().bgp_as_service_index_table(). 36 0 : TriggerBackup(); 37 : 38 0 : } 39 0 : bool BgpAsServiceIndexResourceKey::IsLess(const ResourceKey &rhs) const { 40 0 : const BgpAsServiceIndexResourceKey *vm_key = 41 : static_cast<const BgpAsServiceIndexResourceKey *>(&rhs); 42 0 : return uuid_ < vm_key->uuid_; 43 : }