OpenSDN source code
bgp_as_service_index.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
3  * Copyright Contributors to the OpenSDN project
4  */
5 
6 #include "cmn/agent.h"
7 #include "cmn/agent_cmn.h"
8 #include <sandesh/sandesh_types.h>
9 #include <sandesh/sandesh.h>
13 #include "bgp_as_service_index.h"
14 #include "resource_manager/resource_manager_types.h"
16 
19  Resource::BGP_AS_SERVICE_INDEX), uuid_(uuid) {
20 
21 }
22 
24  IndexResourceData *index_data = static_cast<IndexResourceData *>(data);
25  if (op == ResourceBackupReq::DEL) {
26  rm()->backup_mgr()->
27  sandesh_maps().DeleteBgpAsServiceResourceEntry(index_data->index());
28  } else {
29  BgpAsServiceIndexResource backup_data;
30  backup_data.set_uuid(UuidToString(uuid_));
31  backup_data.set_time_stamp(UTCTimestampUsec());
32  rm()->backup_mgr()->
33  sandesh_maps().AddBgpAsServiceResourceEntry(index_data->index(),
34  backup_data);
35  }
37  TriggerBackup();
38 
39 }
41  const BgpAsServiceIndexResourceKey *vm_key =
42  static_cast<const BgpAsServiceIndexResourceKey *>(&rhs);
43  return uuid_ < vm_key->uuid_;
44 }
virtual void Backup(ResourceData *data, uint16_t op)
virtual bool IsLess(const ResourceKey &rhs) const
BgpAsServiceIndexResourceKey(ResourceManager *rm, const boost::uuids::uuid &uuid_)
uint32_t index() const
ResourceSandeshMaps & sandesh_maps()
ResourceManager * rm()
ResourceBackupManager * backup_mgr()
BgpAsServiceBackUpResourceTable & bgp_as_service_index_table()
Definition: sandesh_map.h:294
static std::string UuidToString(const boost::uuids::uuid &id)
Definition: string_util.h:139
static uint64_t UTCTimestampUsec()
Definition: time_util.h:14
boost::uuids::uuid uuid