/*
* Copyright 2017-present Open Networking Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* This is automatically generated callbacks file
* It contains 3 parts: Configuration callbacks, RPC callbacks and state data callbacks.
* Do NOT alter function signatures or any structures unless you know exactly what you are doing.
*/
#include <stdlib.h>
#include <sys/inotify.h>
#include <libxml/tree.h>
#include <libxml/xmlsave.h>
#include <libxml/xmlwriter.h>
#include <libnetconf_xml.h>
#include <voltha-netconf-model.h>
#include <voltha.h>
#include <string.h>
/* transAPI version which must be compatible with libnetconf */
int transapi_version = 6;
/* Signal to libnetconf that configuration data were modified by any callback.
* 0 - data not modified
* 1 - data have been modified
*/
int config_modified = 0;
/*
* Determines the callbacks order.
* Set this variable before compilation and DO NOT modify it in runtime.
* TRANSAPI_CLBCKS_LEAF_TO_ROOT (default)
* TRANSAPI_CLBCKS_ROOT_TO_LEAF
*/
const TRANSAPI_CLBCKS_ORDER_TYPE callbacks_order = TRANSAPI_CLBCKS_ORDER_DEFAULT;
/* Do not modify or set! This variable is set by libnetconf to announce edit-config's error-option
Feel free to use it to distinguish module behavior for different error-option values.
* Possible values:
* NC_EDIT_ERROPT_STOP - Following callback after failure are not executed, all successful callbacks executed till
failure point must be applied to the device.
* NC_EDIT_ERROPT_CONT - Failed callbacks are skipped, but all callbacks needed to apply configuration changes are executed
* NC_EDIT_ERROPT_ROLLBACK - After failure, following callbacks are not executed, but previous successful callbacks are
executed again with previous configuration data to roll it back.
*/
NC_EDIT_ERROPT_TYPE erropt = NC_EDIT_ERROPT_NOTSET;
/**
* @brief Initialize plugin after loaded and before any other functions are called.
* This function should not apply any configuration data to the controlled device. If no
* running is returned (it stays *NULL), complete startup configuration is consequently
* applied via module callbacks. When a running configuration is returned, libnetconf
* then applies (via module's callbacks) only the startup configuration data that
* differ from the returned running configuration data.
* Please note, that copying startup data to the running is performed only after the
* libnetconf's system-wide close - see nc_close() function documentation for more
* information.
* @param[out] running Current configuration of managed device.
* @return EXIT_SUCCESS or EXIT_FAILURE
*/
int transapi_init(xmlDocPtr *running) {
return EXIT_SUCCESS;
}
/**
* @brief Free all resources allocated on plugin runtime and prepare plugin for removal.
*/
void transapi_close(void) {
return;
}
/**
* @brief Retrieve state data from device and return them as XML document
*
* @param model Device data model. libxml2 xmlDocPtr.
* @param running Running datastore content. libxml2 xmlDocPtr.
* @param[out] err Double pointer to error structure. Fill error when some occurs.
* @return State data as libxml2 xmlDocPtr or NULL in case of error.
*/
xmlDocPtr get_state_data(xmlDocPtr model, xmlDocPtr running, struct nc_err **err) {
return(NULL);
}
/*
* Mapping prefixes with namespaces.
* Do NOT modify this structure!
*/
struct ns_pair namespace_mapping[] = {{NULL, NULL}};
/*
* CONFIGURATION callbacks
* Here follows set of callback functions run every time some change in associated part of running datastore occurs.
* You can safely modify the bodies of all function as well as add new functions for better lucidity of code.
*/
/*
* Structure transapi_config_callbacks provide mapping between callback and path in configuration datastore.
* It is used by libnetconf library to decide which callbacks will be run.
* DO NOT alter this structure
*/
struct transapi_data_callbacks clbks = {
.callbacks_count = 0,
.data = NULL,
.callbacks = {
}
};
/**
* @brief Get a node from the RPC input. The first found node is returned, so if traversing lists,
* call repeatedly with result->next as the node argument.
*
* @param name Name of the node to be retrieved.
* @param node List of nodes that will be searched.
* @return Pointer to the matching node or NULL
*/
xmlNodePtr get_rpc_node(const char *name, const xmlNodePtr node) {
xmlNodePtr ret = NULL;
for (ret = node; ret != NULL; ret = ret->next) {
if (xmlStrEqual(BAD_CAST name, ret->name)) {
break;
}
}
return ret;
}
void walk_nodes(const xmlNodePtr node) {
xmlNodePtr ret = NULL;
/*
walk through the document
what to do with nodes ... pass to a channel?
to construct a map at the other end?
*/
for (ret = node; ret != NULL; ret = ret->next) {
if (xmlNodeIsText(ret)) {
nc_verb_verbose("content : %s", (char*)xmlNodeGetContent(ret));
} else {
nc_verb_verbose("name : %s", ret->name);
}
if (ret->children != NULL) {
walk_nodes(ret->children);
}
}
}
/*
* RPC callbacks
* Here follows set of callback functions run every time RPC specific for this device arrives.
* You can safely modify the bodies of all function as well as add new functions for better lucidity of code.
* Every function takes an libxml2 list of inputs as an argument.
* If input was not set in RPC message argument is set to NULL. To retrieve each argument, preferably use get_rpc_node().
*/
/*
* Local service functions
*/
nc_reply *rpc_VolthaLocalService_GetVolthaInstance(xmlNodePtr input) {
return NULL;
}
nc_reply *rpc_VolthaLocalService_GetHealth(xmlNodePtr input) {
HealthStatus health;
health = (HealthStatus) GetHealthStatus();
char* data;
data = (char*) TranslateHealthStatus(health);
return nc_reply_data(data);
}
nc_reply *rpc_VolthaLocalService_ListAdapters(xmlNodePtr input) {
return NULL;
}
nc_reply *rpc_VolthaLocalService_ListLogicalDevices(xmlNodePtr input) {
return NULL;
}
nc_reply *rpc_VolthaLocalService_GetLogicalDevice(xmlNodePtr input) {
return NULL;
}
nc_reply *rpc_VolthaLocalService_ListLogicalDevicePorts(xmlNodePtr input) {
return NULL;
}
nc_reply *rpc_VolthaLocalService_ListLogicalDeviceFlows(xmlNodePtr input) {
return NULL;
}
nc_reply *rpc_VolthaLocalService_UpdateLogicalDeviceFlowTable(xmlNodePtr input) {
return NULL;
}
nc_reply *rpc_VolthaLocalService_ListLogicalDeviceFlowGroups(xmlNodePtr input) {
return NULL;
}
nc_reply *rpc_VolthaLocalService_UpdateLogicalDeviceFlowGroupTable(xmlNodePtr input) {
return NULL;
}
nc_reply *rpc_VolthaLocalService_ListDevices(xmlNodePtr input) {
DeviceArray devices;
devices = (DeviceArray) ListDevices();
char* data;
data = (char*) TranslateDevices(devices);
return nc_reply_data(data);
}
nc_reply *rpc_VolthaLocalService_GetDevice(xmlNodePtr input) {
return NULL;
}
nc_reply *rpc_VolthaLocalService_CreateDevice(xmlNodePtr input) {
Device d;
xmlNodePtr ret = NULL;
if ((ret = get_rpc_node("type", input)) != NULL) {
d.Type = (char*)xmlNodeGetContent(ret);
}
if ((ret = get_rpc_node("host_and_port", input)) != NULL) {
d.Address.Type = (int)HOST_AND_PORT;
d.Address.Value = (char*)xmlNodeGetContent(ret);
} else if ((ret = get_rpc_node("mac_address", input)) != NULL) {
d.Address.Type = (int)MAC;
d.Address.Value = (char*)xmlNodeGetContent(ret);
} else if ((ret = get
没有合适的资源?快使用搜索试试~ 我知道了~
voltha:虚拟OLT硬件抽象
共2425个文件
go:987个
py:651个
md:175个
5星 · 超过95%的资源 需积分: 50 7 下载量 158 浏览量
2021-05-03
14:50:13
上传
评论
收藏 9.35MB ZIP 举报
温馨提示
伏特 什么是沃尔萨? Voltha的目的是在传统和下一代接入网络设备之上提供抽象层,以进行控制和管理。 它最初的重点是PON(GPON,EPON,NG PON 2),但它的目标是超越最终覆盖其他接入技术(xDSL,Docsis,G.FAST,专用以太网,固定无线)。 Voltha的关键概念: 网络作为交换机:它使一组连接的接入网络设备看起来像一个(n抽象)可编程流量设备,一个L2 / L3 / L4交换机。 例子: PON作为交换机 PON +接入回程作为交换机 xDSL服务作为交换机 向虚拟化的演进:它可以与多种(访问)网络技术和设备一起使用,包括传统的,完全虚拟化的(从硬件和软件的分离意义上)以及两者之间。 Voltha可以在设备上,中央办公室或数据中心的通用服务器上运行。 统一的OAM抽象:它提供对设备管理任务的统一,与供应商和技术无关的处理,例如服务生命周期,设备生命周期
资源详情
资源评论
资源推荐
收起资源包目录
voltha:虚拟OLT硬件抽象 (2425个子文件)
aaa_json 471B
Dockerfile.alarm-generator 1KB
Dockerfile.alarm-generator_d 2KB
all 546B
all 358B
Dockerfile.base.alpine 1KB
Dockerfile.base 1KB
bashrc 4KB
reference-inband.block 2KB
reference-inband.block 2KB
reference-internal.block 2KB
reference-internal.block 2KB
olt-states.block 1KB
olt-states.block 1KB
build 570B
voltha.c 22KB
gccgo_c.c 1014B
install.cfg 644B
containers.cfg 385B
ansible.cfg 182B
ansible.cfg 182B
docker.cfg 165B
docker.cfg 165B
Dockerfile.cli 2KB
Dockerfile.cli_custom 963B
Dockerfile.cli_d 2KB
client_keys 52B
client_passwords 43B
cluster 10B
voltha.cnf 3KB
LICENSE.code 11KB
logstash.conf 4KB
default.conf 1KB
fastcgi.conf 1KB
swagger.conf 873B
consul.conf 756B
nginx.conf 647B
fluent.conf 535B
fluent-agg.conf 372B
wpa_supplicant.conf 369B
services.conf 349B
portainer.conf 210B
grafana.conf 151B
supervisord.conf 106B
clients.conf 43B
config-push 397B
Dockerfile.configpush 799B
configure 382KB
Dockerfile.consul 712B
.coveragerc 76B
.coveragerc 75B
voltha.crt 5KB
voltha-cert-template.crt 1KB
voltha-cert-template.crt 1KB
server.crt 1KB
server.csr 1KB
printable.css 946B
nginx-upstreams.ctmpl 341B
Dockerfile.dashd 1006B
mime.types.default 4KB
nginx.conf.default 3KB
fastcgi.conf.default 1KB
fastcgi_params.default 1007B
uwsgi_params.default 664B
scgi_params.default 636B
descriptor.desc 6KB
descriptor.desc 6KB
devices_json 1KB
dhcp_json 415B
dhcpl2relay_json 113B
Dockerfile 1KB
Dockerfile 1KB
Dockerfile 1KB
Dockerfile 52B
.dockerignore 175B
LICENSE.docs 20KB
opennms.env 843B
postgres.env 741B
Dockerfile.envoy 900B
Dockerfile.envoy_d 2KB
fastcgi_params 1007B
Dockerfile.fluentd 1021B
.gitignore 1KB
.gitignore 31B
.gitignore 31B
.gitignore 22B
.gitignore 19B
.gitignore 0B
.gitreview 85B
tables.go 340KB
openflow_13.pb.go 306KB
voltha.pb.go 278KB
tables.go 263KB
tables.go 111KB
entity.go 98KB
zerrors_linux_ppc64le.go 96KB
zerrors_linux_ppc64.go 96KB
zerrors_linux_s390x.go 96KB
zerrors_linux_mipsle.go 94KB
zerrors_linux_mips.go 94KB
共 2425 条
- 1
- 2
- 3
- 4
- 5
- 6
- 25
仰光的瑞哥
- 粉丝: 14
- 资源: 4623
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1