Line data Source code
1 : /* 2 : * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. 3 : * Copyright Contributors to the OpenSDN project 4 : */ 5 : #ifndef vnsw_agent_vgw_h 6 : #define vnsw_agent_vgw_h 7 : 8 : // Simple Virtual Gateway operational class 9 : // Creates the interface, route and nexthop for virtual-gateway 10 : class VirtualGateway { 11 : public: 12 : VirtualGateway(Agent *agent); 13 0 : ~VirtualGateway() {}; 14 : void InterfaceNotify(DBTablePartBase *partition, DBEntryBase *entry); 15 : 16 : void Init(); 17 : void Shutdown(); 18 : void CreateVrf(); 19 : void CreateVrf(const std::string &vrf_name); 20 : void DeleteVrf(const std::string &vrf_name); 21 : void CreateInterfaces(Interface::Transport transport); 22 : void CreateInterface(const std::string &interface_name, 23 : const std::string &vrf_name, 24 : Interface::Transport transport); 25 : void DeleteInterface(const std::string &interface_name); 26 : void SubnetUpdate(const VirtualGatewayConfig &vgw, 27 : const VirtualGatewayConfig::SubnetList &add_list, 28 : const VirtualGatewayConfig::SubnetList &del_list); 29 : void RouteUpdate(const VirtualGatewayConfig &vgw, 30 : const VirtualGatewayConfig::SubnetList &new_list, 31 : const VirtualGatewayConfig::SubnetList &add_list, 32 : const VirtualGatewayConfig::SubnetList &del_list, 33 : bool add_default_route); 34 : void RegisterDBClients(); 35 : 36 : private: 37 : void SubnetUpdate(const std::string &vrf, 38 : InetUnicastAgentRouteTable *rt_table, 39 : const VirtualGatewayConfig::SubnetList &add_list, 40 : const VirtualGatewayConfig::SubnetList &del_list); 41 : void RouteUpdate(const VirtualGatewayConfig &vgw, uint32_t new_list_size, 42 : InetUnicastAgentRouteTable *rt_table, 43 : const VirtualGatewayConfig::SubnetList &add_list, 44 : const VirtualGatewayConfig::SubnetList &del_list, 45 : bool add_default_route, bool del_default_route); 46 : 47 : // Cached entries 48 : Agent *agent_; 49 : DBTableBase::ListenerId listener_id_; 50 : VirtualGatewayConfigTable *vgw_config_table_; 51 : 52 : DISALLOW_COPY_AND_ASSIGN(VirtualGateway); 53 : }; 54 : 55 : #endif //vnsw_agent_vgw_h