diff options
author | Neale Ranns <nranns@cisco.com> | 2019-06-19 08:30:46 -0700 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2019-06-26 16:41:01 +0000 |
commit | a83d9d67113dc75d21a68dba14891ed5e1bea7ec (patch) | |
tree | 829b8724c836bc48be1a45901291df129d678f69 /src/VppSpineProxy.cpp | |
parent | ef426ed7714e87cee2097ed5245a78b92a0158ce (diff) |
Initial Commit of VPP OPflex Renderer
Change-Id: I6264537538ad2646cddfa404de38a6bbf3abaa35
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/VppSpineProxy.cpp')
-rw-r--r-- | src/VppSpineProxy.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/VppSpineProxy.cpp b/src/VppSpineProxy.cpp new file mode 100644 index 0000000..b658e2b --- /dev/null +++ b/src/VppSpineProxy.cpp @@ -0,0 +1,66 @@ +/* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */ +/* + * Copyright (c) 2017-2018 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +#include <vom/om.hpp> +#include <vom/vxlan_tunnel.hpp> + +#include "VppSpineProxy.hpp" + +using namespace VOM; + +namespace VPP +{ +SpineProxy::SpineProxy(const boost::asio::ip::address_v4 &local, + const boost::asio::ip::address_v4 &remote_v4, + const boost::asio::ip::address_v4 &remote_v6, + const boost::asio::ip::address_v4 &remote_mac) + : m_local(local) + , m_remote_v4(remote_v4) + , m_remote_v6(remote_v6) + , m_remote_mac(remote_mac) +{ +} + +const std::shared_ptr<VOM::vxlan_tunnel> +SpineProxy::mk_v4(const std::string &key, uint32_t vnid) +{ + return (mk_intf(key, m_local, m_remote_v4, vnid)); +} + +const std::shared_ptr<VOM::vxlan_tunnel> +SpineProxy::mk_v6(const std::string &key, uint32_t vnid) +{ + return (mk_intf(key, m_local, m_remote_v6, vnid)); +} + +const std::shared_ptr<VOM::vxlan_tunnel> +SpineProxy::mk_mac(const std::string &key, uint32_t vnid) +{ + return (mk_intf(key, m_local, m_remote_mac, vnid)); +} + +const std::shared_ptr<VOM::vxlan_tunnel> +SpineProxy::mk_intf(const std::string &key, + boost::asio::ip::address_v4 &src, + boost::asio::ip::address_v4 &dst, + uint32_t vnid) +{ + std::shared_ptr<VOM::vxlan_tunnel> vt = std::make_shared<vxlan_tunnel>( + src, dst, vnid, vxlan_tunnel::mode_t::GBP_L2); + OM::write(key, *vt); + + return vt; +} +}; + +/* + * Local Variables: + * eval: (c-set-style "llvm.org") + * End: + */ |