diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 00000000..9a98398b --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,8 @@ +# This file provides an overview of code owners in this repository. + +# Each line is a file pattern followed by one or more owners. +# The last matching pattern has the most precedence. +# For more details, read the following article on GitHub: https://help.github.com/articles/about-codeowners/. + +# These are the default owners for the whole content of this repository. The default owners are automatically added as reviewers when you open a pull request, unless different owners are specified in the file. +* @iffy50 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..e1811e07 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,130 @@ + +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +[opensource@telekom.de](mailto:opensource@telekom.de). +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..4c4bd559 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,73 @@ +# Contributing + +## Code of conduct + +All members of the project community must abide by the [Contributor Covenant, version 2.0](CODE_OF_CONDUCT.md). +Only by respecting each other can we develop a productive, collaborative community. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting [opensource@telekom.de](mailto:opensource@telekom.de) and/or a project maintainer. + +We appreciate your courtesy of avoiding political questions here. Issues which are not related to the project itself will be closed by our community managers. + +## Engaging in our project + +We use GitHub to manage reviews of pull requests. + +* If you are a new contributor, see: [Steps to Contribute](#steps-to-contribute) + +* If you have a trivial fix or improvement, go ahead and create a pull request, addressing (with `@...`) a suitable maintainer of this repository (see [CODEOWNERS](CODEOWNERS) of the repository you want to contribute to) in the description of the pull request. + +* If you plan to do something more involved, please reach out to us and send an [email](mailto:opensource@telekom.de). This will avoid unnecessary work and surely give you and us a good deal of inspiration. + +* Relevant coding style guidelines are available in the respective sub-repositories as they are programming language-dependent. + +## Steps to Contribute + +Should you wish to work on an issue, please claim it first by commenting on the GitHub issue that you want to work on. This is to prevent duplicated efforts from other contributors on the same issue. + +If you have questions about one of the issues, please comment on them, and one of the maintainers will clarify. + +We kindly ask you to follow the [Pull Request Checklist](#Pull-Request-Checklist) to ensure reviews can happen accordingly. + +## Contributing Code + +You are welcome to contribute code in order to fix a bug or to implement a new feature. + +The following rule governs code contributions: + +* Contributions must be licensed under the [MIT License](LICENSE) +* Newly created files must be opened by an instantiated version to the file 'templates/file-header.txt' +* At least if you add a new file to the repository, add your name into the contributor section of the file NOTICE (please respect the preset entry structure) + +## Contributing Documentation + +You are welcome to contribute documentation to the project. + +The following rule governs documentation contributions: + +* Contributions must be licensed under the same license as code, the [MIT License](LICENSE) + +## Pull Request Checklist + +* Branch from the master branch and, if needed, rebase to the current master branch before submitting your pull request. If it doesn't merge cleanly with master you may be asked to rebase your changes. + +* Commits should be as small as possible while ensuring that each commit is correct independently (i.e., each commit should compile and pass tests). + +* Test your changes as thoroughly as possible before you commit them. Preferably, automate your test by unit/integration tests. If tested manually, provide information about the test scope in the PR description (e.g. “Test passed: Upgrade version from 0.42 to 0.42.23.”). + +* Create _Work In Progress [WIP]_ pull requests only if you need clarification or an explicit review before you can continue your work item. + +* If your patch is not getting reviewed or you need a specific person to review it, you can @-reply a reviewer asking for a review in the pull request or a comment, or you can ask for a review by contacting us via [email](mailto:opensource@telekom.de). + +* Post review: + * If a review requires you to change your commit(s), please test the changes again. + * Amend the affected commit(s) and force push onto your branch. + * Set respective comments in your GitHub review to resolved. + * Create a general PR comment to notify the reviewers that your amendments are ready for another round of review. + +## Issues and Planning + +* We use GitHub issues to track bugs and enhancement requests. + +* Please provide as much context as possible when you open an issue. The information you provide must be comprehensive enough to reproduce that issue for the assignee. Therefore, contributors may use but aren't restricted to the issue template provided by the project maintainers. + +* When creating an issue, try using one of our issue templates which already contain some guidelines on which content is expected to process the issue most efficiently. If no template applies, you can of course also create an issue from scratch. diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..bc8fb7a3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,11 @@ +Copyright (c) 2021 Deutsche Telekom AG. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index 71034208..b2783bc1 100644 --- a/README.md +++ b/README.md @@ -1,434 +1,113 @@ -# Sysrepo interfaces plugin +

+ Sysrepo Plugin Interfaces +

-## Introduction +

+ + + +

-This Sysrepo plugin is responsible for bridging a Linux system and Sysrepo/YANG datastore network interfaces configuration. +

+ Development • + Documentation • + Support • + Contribute • + Contributors • + Licensing +

-## Dependencies +The goal of this project is to provide a method of configuring networking on generic Linux systems using the Sysrepo NETCONF server implementation. -Other than libyang and Sysrepo, there are some other dependencies required to build and use this plugin. -These include pthreads and the libnl (https://www.infradead.org/~tgr/libnl/) netlink library. +## About this component -## Build +This Sysrepo plugin is based on the `ietf-interfaces` YANG module which contains "a collection of YANG definitions for managing network interfaces". More information about the specific YANG module can be found in [RFC 7223: A YANG Data Model for Interface Management](https://datatracker.ietf.org/doc/html/rfc7223). -This section describes how to build the plugin on hosts that have Sysrepo installed. This -includes standard Linux machines and docker images with Sysrepo, Netopeer and other required dependencies. -Additionally, a Dockerfile that builds all the dependencies and the plugin is available in `docker/` +## Development -First, clone the repo: -``` -$ git clone git@lab.sartura.hr:sysrepo/sysrepo-plugin-interfaces.git -``` - -Next, make a build directory and prepare the build scripts: +Besides the usual C development environment, the following additional dependencies are required: -``` -$ mkdir build && cd build -$ cmake .. -``` +* libyang +* sysrepo +* pthreads +* netlink -This will build the plugin as a standalone executable which can be run without `sysrepo-plugind` +### Build -To build the project in plugin mode, run the following instead: +First clone the repository: ``` -$ cmake -DPLUGIN=ON .. +$ git clone https://github.com/telekom/sysrepo-plugin-interfaces ``` -After that, run `make` and `make install` - -## Development Setup - -Setup the development environment using the provided [`setup-dev-sysrepo`](https://github.com/sartura/setup-dev-sysrepo) scripts. This will build all the necessary components. - -Subsequent rebuilds of the plugin may be done by navigating to the plugin source directory and executing: - -``` -$ export SYSREPO_DIR=${HOME}/code/sysrepofs -$ cd ${SYSREPO_DIR}/repositories/plugins/sysrepo-plugin-interfaces - -$ rm -rf ./build && mkdir ./build && cd ./build -$ cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ - -DCMAKE_PREFIX_PATH=${SYSREPO_DIR} \ - -DCMAKE_INSTALL_PREFIX=${SYSREPO_DIR} \ - -DCMAKE_BUILD_TYPE=Debug \ - .. --- Configuring done --- Generating done --- Build files have been written to: ${SYSREPO_DIR}/repositories/plugins/sysrepo-plugin-interfaces/build -Scanning dependencies of target sysrepo-plugin-interfaces -[ 33%] Building C object CMakeFiles/sysrepo-plugin-interfaces.dir/src/interfaces.c.o -[ 66%] Linking C executable sysrepo-plugin-interfaces -[100%] Built target sysrepo-plugin-interfaces - -$ make && make install -[...] -[100%] Built target sysrepo-plugin-interfaces -[100%] Built target sysrepo-plugin-interfaces -Install the project... --- Install configuration: "Debug" --- Installing: ${SYSREPO_DIR}/bin/sysrepo-plugin-interfaces --- Set runtime path of "${SYSREPO_DIR}/bin/sysrepo-plugin-interfaces" to "" - --$ cd .. -``` - -Before using the plugin it is necessary to install relevant YANG modules. For this particular plugin, the following commands need to be invoked: - -``` -$ cd ${SYSREPO_DIR}/repositories/plugins/sysrepo-plugin-interfaces -$ export LD_LIBRARY_PATH="${SYSREPO_DIR}/lib64;${SYSREPO_DIR}/lib" -$ export PATH="${SYSREPO_DIR}/bin:${PATH}" -``` - -## Running and Examples - -This plugin is installed as the `sysrepo-plugin-interfaces` binary to `${SYSREPO_DIR}/bin/` directory path, if installed with the setup-dev scripts. - -The `IF_PLUGIN_DATA_DIR` environment variable will be used to save internal plugin information that is used to load and store data of some yang nodes. -Currently it only stores data for the `description` node of the `ietf-interfaces` yang model in the file `interface_description`. -This ensures that set descriptions are preserved between plugin runs. - -Setting the environment variable `IF_PLUGIN_DATA_DIR` is optional, if not set the default location will be: +Next, create a build directory and generate the build recipes using CMake: ``` -/usr/local/lib/sysrepo-interfaces-plugin -``` - -Here is an example of creating a directory and setting the `IF_PLUGIN_DATA_DIR` to its path: - -``` -mkdir -p /usr/local/lib/sysrepo-interfaces-plugin -export IF_PLUGIN_DATA_DIR=/usr/local/lib/sysrepo-interfaces-plugin -``` - -YANG models describing interface related functionality have to be installed: - -``` -$ sysrepoctl -i yang/iana-if-type@2017-01-19.yang -$ sysrepoctl -i yang/ietf-interfaces@2018-02-20.yang -$ sysrepoctl -i yang/ietf-ip@2014-06-16.yang -$ sysrepoctl -i yang/ietf-if-extensions@2020-07-29.yang -$ sysrepoctl -i yang/ieee802-dot1q-types.yang -$ sysrepoctl -i yang/ietf-if-vlan-encapsulation@2020-07-13.yang -``` - -`sub-interfaces` feature has to be enabled: -``` -$ sysrepoctl --change ietf-if-extensions --enable-feature sub-interfaces -``` - -After enabling the feature simply invoke this binary: -``` -$ sysrepo-plugin-interfaces -[...] -[INF]: Applying scheduled changes. -[INF]: No scheduled changes. -[INF]: Connection "..." created. -[INF]: Session "..." (user "...", CID "...") created. -[INF]: plugin: start session to startup datastore -[INF]: Session "..." (user "...", CID "...") created. -[INF]: plugin: plugin init done -[...] +$ mkdir build +$ cd build +$ cmake .. ``` -If the project was built in plugin mode, run the following command: +The default configuration builds the plugin as a stand-alone foreground application. To build the plugin as a shared object file for use with `sysrepo-plugind`, run the following instead: ``` -$ sysrepo-plugind -v 4 -d +$ cmake -DPLUGIN=ON .. ``` -Output from the plugin is expected; the plugin has been initialized with `startup` and `running` datastore contents at `${SYSREPO_DIR}/etc/sysrepo`. We can confirm the contents present in Sysrepo by invoking the following command: +Lastly, invoke the build and install using `make`: ``` -$ sysrepocfg -X -d startup -f json -m 'ietf-interfaces' -{ - "ietf-interfaces:interfaces": { - "interface": [ - { - "name": "lo", - "description": "", - "type": "iana-if-type:softwareLoopback", - "enabled": false - }, - { - "name": "wlan0", - "description": "", - "type": "iana-if-type:ethernetCsmacd", - "enabled": true - }, - { - "name": "enp0s31f6", - "description": "", - "type": "iana-if-type:ethernetCsmacd", - "enabled": true - } - ] - } -} - +$ make -j$(nproc) install ``` -Operational state data, as defined by the `ietf-interfaces` module can be accessed with: +The plugin requires the several YANG modules to be loaded into the Sysrepo datastore. This can be achieved by invoking the following commands: ``` -$ sysrepocfg -X -d operational -f json -x '/ietf-interfaces:interfaces' -{ - "ietf-interfaces:interfaces": { - "interface": [ - { - "name": "lo", - "description": "", - "oper-status": "unknown", - "phys-address": "00:00:00:00:00:00", - "speed": "0", - "statistics": { - "discontinuity-time": "2021-03-26T10:14:06Z", - "in-octets": "78480", - "in-unicast-pkts": "0", - "in-broadcast-pkts": "0", - "in-multicast-pkts": "0", - "in-discards": 0, - "in-errors": 0, - "in-unknown-protos": 0, - "out-octets": "78480", - "out-unicast-pkts": "1308", - "out-broadcast-pkts": "0", - "out-multicast-pkts": "0", - "out-discards": 0, - "out-errors": 0 - } - }, - { - "name": "wlan0", - "description": "", - "oper-status": "up", - "phys-address": "68:3e:26:b9:c6:02", - "speed": "0", - "statistics": { - "discontinuity-time": "2021-03-26T10:14:06Z", - "in-octets": "352955", - "in-unicast-pkts": "18446744073709548532", - "in-broadcast-pkts": "0", - "in-multicast-pkts": "0", - "in-discards": 0, - "in-errors": 0, - "in-unknown-protos": 0, - "out-octets": "10994", - "out-unicast-pkts": "96", - "out-broadcast-pkts": "0", - "out-multicast-pkts": "7", - "out-discards": 0, - "out-errors": 0 - } - }, - { - "name": "enp0s31f6", - "description": "", - "oper-status": "up", - "phys-address": "8c:8c:aa:43:cc:f8", - "speed": "0", - "statistics": { - "discontinuity-time": "2021-03-26T10:14:06Z", - "in-octets": "730093500", - "in-unicast-pkts": "18446744073709551445", - "in-broadcast-pkts": "0", - "in-multicast-pkts": "7069", - "in-discards": 6809, - "in-errors": 0, - "in-unknown-protos": 0, - "out-octets": "25237778", - "out-unicast-pkts": "144804", - "out-broadcast-pkts": "0", - "out-multicast-pkts": "75", - "out-discards": 0, - "out-errors": 0 - } - } - ] - } -} +$ sysrepoctl -i ./yang/iana-if-type@2017-01-19.yang +$ sysrepoctl -i ./yang/ietf-interfaces@2018-02-20.yang +$ sysrepoctl -i ./yang/ietf-ip@2014-06-16.yang +$ sysrepoctl -i ./yang/ietf-if-extensions@2020-07-29.yang +$ sysrepoctl -i ./yang/ieee802-dot1q-types.yang +$ sysrepoctl -i ./yang/ietf-if-vlan-encapsulation@2020-07-13.yang ``` -## YANG Overview - -The `ietf-interfaces` YANG module with the `if` prefix consists of the following `container` paths: +## Code of Conduct -* `/ietf-interfaces:interfaces` — configuration and operational data for the system +This project has adopted the [Contributor Covenant](https://www.contributor-covenant.org/) in version 2.0 as our code of conduct. Please see the details in our [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md). All contributors must abide by the code of conduct. -The following leaves are for configuration: +## Working Language -* `name` -* `description` -* `type` -* `enabled` -* `link-up-down-trap-enable` +We decided to apply _English_ as the primary project language. - note: currently only the following network interface types (`type` node) from IANA Interface Type YANG Module are supported: +Consequently, all content will be made available primarily in English. We also ask all interested people to use English as language to create issues, in their code (comments, documentation etc.) and when you send requests to us. The application itself and all end-user facing content will be made available in other languages as needed. - * ethernetCsmacd - * softwareLoopback - * l2vlan - * other - dummy interface type +## Documentation -The following items are operational state data: +The full documentation for the Sysrepo interfaces plugin can be found in the [documentation directory](../docs). -* `admin-status` -* `oper-status` -* `last-change?` -* `if-index` -* `phys-address?` -* `higher-layer-if*` -* `lower-layer-if*` -* `speed` -* `statistics`: +## Support and Feedback +The following channels are available for discussions, feedback, and support requests: - - `discontinuity-time` - - `in-octets` - - `in-unicast-pkts` - - `in-broadcast-pkts` - - `in-multicast-pkts` - - `in-discards` - - `in-errors` - - `in-unknown-protos` - - `out-octets` - - `out-unicast-pkts` - - `out-broadcast-pkts` - - `out-multicast-pkts` - - `out-discards` - - `out-errors` +| Type | Channel | +| ------------------------ | ------------------------------------------------------ | +| **Issues** | | +| **Other Requests** | | +## How to Contribute +Contribution and feedback is encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our [Contribution Guidelines](./CONTRIBUTING.md). By participating in this project, you agree to abide by its [Code of Conduct](./CODE_OF_CONDUCT.md) at all times. -* `interfaces-state` is obsolete +## Contributors +Our commitment to open source means that we are enabling -in fact encouraging- all interested parties to contribute and become part of its developer community. +## Licensing -## Testing -The `tests/manual_tests.md` file contains a list of sysrepo commands that can be used to test -the currently implemented features of the plugin. +Copyright (C) 2021 Deutsche Telekom AG. +Licensed under the **BSD 3-Clause License** (the "License"); you may not use this file except in compliance with the License. -## Nodes that are currently implemented +You may obtain a copy of the License by reviewing the file [LICENSE](./LICENSE) in the repository. -- DONE - nodes are implemented and a value is provided if such information can be retrieved -- NA - node is not implemented -- IN PROGRESS - implementation in progress -``` -module: ietf-interfaces - +--rw interfaces - +--rw interface* [name] - +--rw name string DONE - +--rw description? string DONE - +--rw type identityref DONE - +--rw enabled? boolean DONE - +--rw link-up-down-trap-enable? enumeration {if-mib}? NA - +--ro admin-status enumeration {if-mib}? NA - +--ro oper-status enumeration DONE - +--ro last-change? yang:date-and-time DONE - +--ro if-index int32 {if-mib}? DONE - +--ro phys-address? yang:phys-address DONE - +--ro higher-layer-if* interface-ref DONE - +--ro lower-layer-if* interface-ref DONE - +--ro speed? yang:gauge64 DONE - +--ro statistics - +--ro discontinuity-time yang:date-and-time IN PROGRESS - +--ro in-octets? yang:counter64 DONE - +--ro in-unicast-pkts? yang:counter64 DONE - +--ro in-broadcast-pkts? yang:counter64 DONE - +--ro in-multicast-pkts? yang:counter64 DONE - +--ro in-discards? yang:counter32 DONE - +--ro in-errors? yang:counter32 DONE - +--ro in-unknown-protos? yang:counter32 DONE - +--ro out-octets? yang:counter64 DONE - +--ro out-unicast-pkts? yang:counter64 DONE - +--ro out-broadcast-pkts? yang:counter64 DONE - +--ro out-multicast-pkts? yang:counter64 DONE - +--ro out-discards? yang:counter32 DONE - +--ro out-errors? yang:counter32 DONE - - -module: ietf-if-extensions - augment /if:interfaces/if:interface: - +--rw carrier-delay {carrier-delay}? - | +--rw down? uint32 NA - | +--rw up? uint32 NA - | +--ro carrier-transitions? yang:counter64 NA - | +--ro timer-running? enumeration NA - +--rw dampening! {dampening}? - | +--rw half-life? uint32 NA - | +--rw reuse? uint32 NA - | +--rw suppress? uint32 NA - | +--rw max-suppress-time? uint32 NA - | +--ro penalty? uint32 NA - | +--ro suppressed? boolean NA - | +--ro time-remaining? uint32 NA - +--rw encapsulation - | +--rw (encaps-type)? DONE - +--rw loopback? identityref {loopback}? NA - +--rw max-frame-size? uint32 {max-frame-size}? NA - +--ro forwarding-mode? identityref NA - augment /if:interfaces/if:interface: - +--rw parent-interface if:interface-ref {sub-interfaces}? DONE - augment /if:interfaces/if:interface/if:statistics: - +--ro in-discard-unknown-encaps? yang:counter64 NA - {sub-interfaces}? - - -module: ietf-if-vlan-encapsulation - augment /if:interfaces/if:interface/if-ext:encapsulation - /if-ext:encaps-type: - +--:(dot1q-vlan) - +--rw dot1q-vlan QinQ not yet supported, second-tag is ignored and normal vlan is created - +--rw outer-tag - | +--rw tag-type dot1q-tag-type IN PROGRESS (currently only normal vlan supported) - | +--rw vlan-id vlanid IN PROGRESS (currently only normal vlan supported) - +--rw second-tag! - +--rw tag-type dot1q-tag-type IN PROGRESS (currently only normal vlan supported) - +--rw vlan-id vlanid IN PROGRESS (currently only normal vlan supported) - -module: ietf-ip - augment /if:interfaces/if:interface: - +--rw ipv4! - | +--rw enabled? boolean IN PROGRESS - | +--rw forwarding? boolean DONE - | +--rw mtu? uint16 DONE - | +--rw address* [ip] - | | +--rw ip inet:ipv4-address-no-zone DONE - | | +--rw (subnet) - | | | +--:(prefix-length) - | | | | +--rw prefix-length? uint8 DONE - | | | +--:(netmask) - | | | +--rw netmask? yang:dotted-quad - | | | {ipv4-non-contiguous-netmasks}? DONE - | | +--ro origin? ip-address-origin NA - | +--rw neighbor* [ip] - | +--rw ip inet:ipv4-address-no-zone DONE - | +--rw link-layer-address yang:phys-address DONE - | +--ro origin? neighbor-origin NA - +--rw ipv6! - +--rw enabled? boolean DONE - +--rw forwarding? boolean DONE - +--rw mtu? uint32 DONE - +--rw address* [ip] - | +--rw ip inet:ipv6-address-no-zone DONE - | +--rw prefix-length uint8 DONE - | +--ro origin? ip-address-origin NA - | +--ro status? enumeration NA - +--rw neighbor* [ip] - | +--rw ip inet:ipv6-address-no-zone DONE - | +--rw link-layer-address yang:phys-address DONE - | +--ro origin? neighbor-origin NA - | +--ro is-router? empty NA - | +--ro state? enumeration NA - +--rw dup-addr-detect-transmits? uint32 NA - +--rw autoconf - +--rw create-global-addresses? boolean NA - +--rw create-temporary-addresses? boolean NA - | {ipv6-privacy-autoconf}? - +--rw temporary-valid-lifetime? uint32 NA - | {ipv6-privacy-autoconf}? - +--rw temporary-preferred-lifetime? uint32 - {ipv6-privacy-autoconf}? NA -``` +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](./LICENSE) for the specific language governing permissions and limitations under the License. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..68d96353 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,8 @@ +# Reporting Security Vulnerabilities + +This project is built with security and data privacy in mind to ensure your data is safe. We are grateful for security researchers and users reporting a vulnerability to us, first. To ensure that your request is handled in a timely manner and non-disclosure of vulnerabilities can be assured, please follow the below guideline. + +**Please do not report security vulnerabilities directly on GitHub. GitHub Issues can be publicly seen and therefore would result in a direct disclosure.** + +* Please address questions about data privacy, security concepts, and other media requests to the opensource@telekom.de mailbox. + diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md new file mode 100644 index 00000000..534ededf --- /dev/null +++ b/docs/DEVELOPMENT.md @@ -0,0 +1,395 @@ +## Development Setup + +Setup the development environment using the provided [`setup-dev-sysrepo`](https://github.com/sartura/setup-dev-sysrepo) scripts. This will build all the necessary components. + +Subsequent rebuilds of the plugin may be done by navigating to the plugin source directory and executing: + +``` +$ export SYSREPO_DIR=${HOME}/code/sysrepofs +$ cd ${SYSREPO_DIR}/repositories/plugins/sysrepo-plugin-interfaces + +$ rm -rf ./build && mkdir ./build && cd ./build +$ cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ + -DCMAKE_PREFIX_PATH=${SYSREPO_DIR} \ + -DCMAKE_INSTALL_PREFIX=${SYSREPO_DIR} \ + -DCMAKE_BUILD_TYPE=Debug \ + .. +-- Configuring done +-- Generating done +-- Build files have been written to: ${SYSREPO_DIR}/repositories/plugins/sysrepo-plugin-interfaces/build +Scanning dependencies of target sysrepo-plugin-interfaces +[ 33%] Building C object CMakeFiles/sysrepo-plugin-interfaces.dir/src/interfaces.c.o +[ 66%] Linking C executable sysrepo-plugin-interfaces +[100%] Built target sysrepo-plugin-interfaces + +$ make && make install +[...] +[100%] Built target sysrepo-plugin-interfaces +[100%] Built target sysrepo-plugin-interfaces +Install the project... +-- Install configuration: "Debug" +-- Installing: ${SYSREPO_DIR}/bin/sysrepo-plugin-interfaces +-- Set runtime path of "${SYSREPO_DIR}/bin/sysrepo-plugin-interfaces" to "" + +-$ cd .. +``` + +Before using the plugin it is necessary to install relevant YANG modules. For this particular plugin, the following commands need to be invoked: + +``` +$ cd ${SYSREPO_DIR}/repositories/plugins/sysrepo-plugin-interfaces +$ export LD_LIBRARY_PATH="${SYSREPO_DIR}/lib64;${SYSREPO_DIR}/lib" +$ export PATH="${SYSREPO_DIR}/bin:${PATH}" +``` + +## Running and Examples + +This plugin is installed as the `sysrepo-plugin-interfaces` binary to `${SYSREPO_DIR}/bin/` directory path, if installed with the setup-dev scripts. + +The `IF_PLUGIN_DATA_DIR` environment variable will be used to save internal plugin information that is used to load and store data of some yang nodes. +Currently it only stores data for the `description` node of the `ietf-interfaces` yang model in the file `interface_description`. +This ensures that set descriptions are preserved between plugin runs. + +Setting the environment variable `IF_PLUGIN_DATA_DIR` is optional, if not set the default location will be: + +``` +/usr/local/lib/sysrepo-interfaces-plugin +``` + +Here is an example of creating a directory and setting the `IF_PLUGIN_DATA_DIR` to its path: + +``` +mkdir -p /usr/local/lib/sysrepo-interfaces-plugin +export IF_PLUGIN_DATA_DIR=/usr/local/lib/sysrepo-interfaces-plugin +``` + +YANG models describing interface related functionality have to be installed: + +``` +$ sysrepoctl -i yang/iana-if-type@2017-01-19.yang +$ sysrepoctl -i yang/ietf-interfaces@2018-02-20.yang +$ sysrepoctl -i yang/ietf-ip@2014-06-16.yang +$ sysrepoctl -i yang/ietf-if-extensions@2020-07-29.yang +$ sysrepoctl -i yang/ieee802-dot1q-types.yang +$ sysrepoctl -i yang/ietf-if-vlan-encapsulation@2020-07-13.yang +``` + +`sub-interfaces` feature has to be enabled: +``` +$ sysrepoctl --change ietf-if-extensions --enable-feature sub-interfaces +``` + +After enabling the feature simply invoke this binary: +``` +$ sysrepo-plugin-interfaces +[...] +[INF]: Applying scheduled changes. +[INF]: No scheduled changes. +[INF]: Connection "..." created. +[INF]: Session "..." (user "...", CID "...") created. +[INF]: plugin: start session to startup datastore +[INF]: Session "..." (user "...", CID "...") created. +[INF]: plugin: plugin init done +[...] +``` + +If the project was built in plugin mode, run the following command: + +``` +$ sysrepo-plugind -v 4 -d +``` + +Output from the plugin is expected; the plugin has been initialized with `startup` and `running` datastore contents at `${SYSREPO_DIR}/etc/sysrepo`. We can confirm the contents present in Sysrepo by invoking the following command: + +``` +$ sysrepocfg -X -d startup -f json -m 'ietf-interfaces' +{ + "ietf-interfaces:interfaces": { + "interface": [ + { + "name": "lo", + "description": "", + "type": "iana-if-type:softwareLoopback", + "enabled": false + }, + { + "name": "wlan0", + "description": "", + "type": "iana-if-type:ethernetCsmacd", + "enabled": true + }, + { + "name": "enp0s31f6", + "description": "", + "type": "iana-if-type:ethernetCsmacd", + "enabled": true + } + ] + } +} + +``` + +Operational state data, as defined by the `ietf-interfaces` module can be accessed with: + +``` +$ sysrepocfg -X -d operational -f json -x '/ietf-interfaces:interfaces' +{ + "ietf-interfaces:interfaces": { + "interface": [ + { + "name": "lo", + "description": "", + "oper-status": "unknown", + "phys-address": "00:00:00:00:00:00", + "speed": "0", + "statistics": { + "discontinuity-time": "2021-03-26T10:14:06Z", + "in-octets": "78480", + "in-unicast-pkts": "0", + "in-broadcast-pkts": "0", + "in-multicast-pkts": "0", + "in-discards": 0, + "in-errors": 0, + "in-unknown-protos": 0, + "out-octets": "78480", + "out-unicast-pkts": "1308", + "out-broadcast-pkts": "0", + "out-multicast-pkts": "0", + "out-discards": 0, + "out-errors": 0 + } + }, + { + "name": "wlan0", + "description": "", + "oper-status": "up", + "phys-address": "68:3e:26:b9:c6:02", + "speed": "0", + "statistics": { + "discontinuity-time": "2021-03-26T10:14:06Z", + "in-octets": "352955", + "in-unicast-pkts": "18446744073709548532", + "in-broadcast-pkts": "0", + "in-multicast-pkts": "0", + "in-discards": 0, + "in-errors": 0, + "in-unknown-protos": 0, + "out-octets": "10994", + "out-unicast-pkts": "96", + "out-broadcast-pkts": "0", + "out-multicast-pkts": "7", + "out-discards": 0, + "out-errors": 0 + } + }, + { + "name": "enp0s31f6", + "description": "", + "oper-status": "up", + "phys-address": "8c:8c:aa:43:cc:f8", + "speed": "0", + "statistics": { + "discontinuity-time": "2021-03-26T10:14:06Z", + "in-octets": "730093500", + "in-unicast-pkts": "18446744073709551445", + "in-broadcast-pkts": "0", + "in-multicast-pkts": "7069", + "in-discards": 6809, + "in-errors": 0, + "in-unknown-protos": 0, + "out-octets": "25237778", + "out-unicast-pkts": "144804", + "out-broadcast-pkts": "0", + "out-multicast-pkts": "75", + "out-discards": 0, + "out-errors": 0 + } + } + ] + } +} +``` + +## YANG Overview + +The `ietf-interfaces` YANG module with the `if` prefix consists of the following `container` paths: + +* `/ietf-interfaces:interfaces` — configuration and operational data for the system + +The following leaves are for configuration: + +* `name` +* `description` +* `type` +* `enabled` +* `link-up-down-trap-enable` + + note: currently only the following network interface types (`type` node) from IANA Interface Type YANG Module are supported: + + * ethernetCsmacd + * softwareLoopback + * l2vlan + * other - dummy interface type + +The following items are operational state data: + +* `admin-status` +* `oper-status` +* `last-change?` +* `if-index` +* `phys-address?` +* `higher-layer-if*` +* `lower-layer-if*` +* `speed` +* `statistics`: + + + - `discontinuity-time` + - `in-octets` + - `in-unicast-pkts` + - `in-broadcast-pkts` + - `in-multicast-pkts` + - `in-discards` + - `in-errors` + - `in-unknown-protos` + - `out-octets` + - `out-unicast-pkts` + - `out-broadcast-pkts` + - `out-multicast-pkts` + - `out-discards` + - `out-errors` + + + +* `interfaces-state` is obsolete + + + +## Testing +The `tests/manual_tests.md` file contains a list of sysrepo commands that can be used to test +the currently implemented features of the plugin. + + +## Nodes that are currently implemented + +- DONE - nodes are implemented and a value is provided if such information can be retrieved +- NA - node is not implemented +- IN PROGRESS - implementation in progress +``` +module: ietf-interfaces + +--rw interfaces + +--rw interface* [name] + +--rw name string DONE + +--rw description? string DONE + +--rw type identityref DONE + +--rw enabled? boolean DONE + +--rw link-up-down-trap-enable? enumeration {if-mib}? NA + +--ro admin-status enumeration {if-mib}? NA + +--ro oper-status enumeration DONE + +--ro last-change? yang:date-and-time DONE + +--ro if-index int32 {if-mib}? DONE + +--ro phys-address? yang:phys-address DONE + +--ro higher-layer-if* interface-ref DONE + +--ro lower-layer-if* interface-ref DONE + +--ro speed? yang:gauge64 DONE + +--ro statistics + +--ro discontinuity-time yang:date-and-time IN PROGRESS + +--ro in-octets? yang:counter64 DONE + +--ro in-unicast-pkts? yang:counter64 DONE + +--ro in-broadcast-pkts? yang:counter64 DONE + +--ro in-multicast-pkts? yang:counter64 DONE + +--ro in-discards? yang:counter32 DONE + +--ro in-errors? yang:counter32 DONE + +--ro in-unknown-protos? yang:counter32 DONE + +--ro out-octets? yang:counter64 DONE + +--ro out-unicast-pkts? yang:counter64 DONE + +--ro out-broadcast-pkts? yang:counter64 DONE + +--ro out-multicast-pkts? yang:counter64 DONE + +--ro out-discards? yang:counter32 DONE + +--ro out-errors? yang:counter32 DONE + + +module: ietf-if-extensions + augment /if:interfaces/if:interface: + +--rw carrier-delay {carrier-delay}? + | +--rw down? uint32 NA + | +--rw up? uint32 NA + | +--ro carrier-transitions? yang:counter64 NA + | +--ro timer-running? enumeration NA + +--rw dampening! {dampening}? + | +--rw half-life? uint32 NA + | +--rw reuse? uint32 NA + | +--rw suppress? uint32 NA + | +--rw max-suppress-time? uint32 NA + | +--ro penalty? uint32 NA + | +--ro suppressed? boolean NA + | +--ro time-remaining? uint32 NA + +--rw encapsulation + | +--rw (encaps-type)? DONE + +--rw loopback? identityref {loopback}? NA + +--rw max-frame-size? uint32 {max-frame-size}? NA + +--ro forwarding-mode? identityref NA + augment /if:interfaces/if:interface: + +--rw parent-interface if:interface-ref {sub-interfaces}? DONE + augment /if:interfaces/if:interface/if:statistics: + +--ro in-discard-unknown-encaps? yang:counter64 NA + {sub-interfaces}? + + +module: ietf-if-vlan-encapsulation + augment /if:interfaces/if:interface/if-ext:encapsulation + /if-ext:encaps-type: + +--:(dot1q-vlan) + +--rw dot1q-vlan QinQ not yet supported, second-tag is ignored and normal vlan is created + +--rw outer-tag + | +--rw tag-type dot1q-tag-type IN PROGRESS (currently only normal vlan supported) + | +--rw vlan-id vlanid IN PROGRESS (currently only normal vlan supported) + +--rw second-tag! + +--rw tag-type dot1q-tag-type IN PROGRESS (currently only normal vlan supported) + +--rw vlan-id vlanid IN PROGRESS (currently only normal vlan supported) + +module: ietf-ip + augment /if:interfaces/if:interface: + +--rw ipv4! + | +--rw enabled? boolean IN PROGRESS + | +--rw forwarding? boolean DONE + | +--rw mtu? uint16 DONE + | +--rw address* [ip] + | | +--rw ip inet:ipv4-address-no-zone DONE + | | +--rw (subnet) + | | | +--:(prefix-length) + | | | | +--rw prefix-length? uint8 DONE + | | | +--:(netmask) + | | | +--rw netmask? yang:dotted-quad + | | | {ipv4-non-contiguous-netmasks}? DONE + | | +--ro origin? ip-address-origin NA + | +--rw neighbor* [ip] + | +--rw ip inet:ipv4-address-no-zone DONE + | +--rw link-layer-address yang:phys-address DONE + | +--ro origin? neighbor-origin NA + +--rw ipv6! + +--rw enabled? boolean DONE + +--rw forwarding? boolean DONE + +--rw mtu? uint32 DONE + +--rw address* [ip] + | +--rw ip inet:ipv6-address-no-zone DONE + | +--rw prefix-length uint8 DONE + | +--ro origin? ip-address-origin NA + | +--ro status? enumeration NA + +--rw neighbor* [ip] + | +--rw ip inet:ipv6-address-no-zone DONE + | +--rw link-layer-address yang:phys-address DONE + | +--ro origin? neighbor-origin NA + | +--ro is-router? empty NA + | +--ro state? enumeration NA + +--rw dup-addr-detect-transmits? uint32 NA + +--rw autoconf + +--rw create-global-addresses? boolean NA + +--rw create-temporary-addresses? boolean NA + | {ipv6-privacy-autoconf}? + +--rw temporary-valid-lifetime? uint32 NA + | {ipv6-privacy-autoconf}? + +--rw temporary-preferred-lifetime? uint32 + {ipv6-privacy-autoconf}? NA +``` diff --git a/interface_description b/interface_description deleted file mode 100644 index e69de29b..00000000 diff --git a/src/interfaces.c b/src/interfaces.c index 63c4f9da..895ceed3 100644 --- a/src/interfaces.c +++ b/src/interfaces.c @@ -1,42 +1,59 @@ -#include -#include "utils/ip_data.h" -#include -#include -#include -#include +/* + * telekom / sysrepo-plugin-interfaces + * + * This program is made available under the terms of the + * BSD 3-Clause license which is available at + * https://opensource.org/licenses/BSD-3-Clause + * + * SPDX-FileCopyrightText: 2021 Deutsche Telekom AG + * SPDX-FileContributor: Sartura Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include +#include +#include +#include +#include + #include #include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include + +#include #include #include #include -#include "utils/memory.h" -#include -#include +#include +#include #include #include #include -#include +#include #include -#include #include -#include -#include +#include +#include + #include -#include -#include -#include +#include +#include +#include + +#include "utils/if_nic_stats.h" #include "utils/if_state.h" -#include +#include "utils/ip_data.h" #include "utils/link_data.h" -#include -#include -#include "utils/if_nic_stats.h" +#include "utils/memory.h" #define BASE_YANG_MODEL "ietf-interfaces" #define BASE_IP_YANG_MODEL "ietf-ip" diff --git a/src/utils/if_nic_stats.c b/src/utils/if_nic_stats.c index 6584c039..0f44e17d 100644 --- a/src/utils/if_nic_stats.c +++ b/src/utils/if_nic_stats.c @@ -1,17 +1,29 @@ -#include -#include -#include -#include -#include -#include -#include +/* + * telekom / sysrepo-plugin-interfaces + * + * This program is made available under the terms of the + * BSD 3-Clause license which is available at + * https://opensource.org/licenses/BSD-3-Clause + * + * SPDX-FileCopyrightText: 2021 Deutsche Telekom AG + * SPDX-FileContributor: Sartura Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause + */ +#include #include -#include #include -#include "memory.h" +#include +#include +#include +#include +#include +#include +#include #include "if_nic_stats.h" +#include "memory.h" int get_nic_stats(char *if_name, nic_stats_t *nic_stats) { @@ -110,4 +122,4 @@ int get_nic_stats(char *if_name, nic_stats_t *nic_stats) } return -1; -} \ No newline at end of file +} diff --git a/src/utils/if_nic_stats.h b/src/utils/if_nic_stats.h index 0f1d8eaa..36f54a07 100644 --- a/src/utils/if_nic_stats.h +++ b/src/utils/if_nic_stats.h @@ -1,3 +1,16 @@ +/* + * telekom / sysrepo-plugin-interfaces + * + * This program is made available under the terms of the + * BSD 3-Clause license which is available at + * https://opensource.org/licenses/BSD-3-Clause + * + * SPDX-FileCopyrightText: 2021 Deutsche Telekom AG + * SPDX-FileContributor: Sartura Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #ifndef IF_NIC_STATS_H_ONCE #define IF_NIC_STATS_H_ONCE @@ -15,4 +28,4 @@ struct nic_stats_s { int get_nic_stats(char *if_name, nic_stats_t *nic_stats); -#endif /* IF_NIC_STATS_H_ONCE */ \ No newline at end of file +#endif /* IF_NIC_STATS_H_ONCE */ diff --git a/src/utils/if_state.c b/src/utils/if_state.c index c5e13f80..dd2b6f11 100644 --- a/src/utils/if_state.c +++ b/src/utils/if_state.c @@ -1,3 +1,16 @@ +/* + * telekom / sysrepo-plugin-interfaces + * + * This program is made available under the terms of the + * BSD 3-Clause license which is available at + * https://opensource.org/licenses/BSD-3-Clause + * + * SPDX-FileCopyrightText: 2021 Deutsche Telekom AG + * SPDX-FileContributor: Sartura Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #include "if_state.h" #include "utils/memory.h" #include diff --git a/src/utils/if_state.h b/src/utils/if_state.h index b8be6b6f..850cd134 100644 --- a/src/utils/if_state.h +++ b/src/utils/if_state.h @@ -1,3 +1,16 @@ +/* + * telekom / sysrepo-plugin-interfaces + * + * This program is made available under the terms of the + * BSD 3-Clause license which is available at + * https://opensource.org/licenses/BSD-3-Clause + * + * SPDX-FileCopyrightText: 2021 Deutsche Telekom AG + * SPDX-FileContributor: Sartura Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #ifndef IF_STATE_H_ONCE #define IF_STATE_H_ONCE diff --git a/src/utils/ip_data.c b/src/utils/ip_data.c index 012fad21..fcfeaccf 100644 --- a/src/utils/ip_data.c +++ b/src/utils/ip_data.c @@ -1,3 +1,16 @@ +/* + * telekom / sysrepo-plugin-interfaces + * + * This program is made available under the terms of the + * BSD 3-Clause license which is available at + * https://opensource.org/licenses/BSD-3-Clause + * + * SPDX-FileCopyrightText: 2021 Deutsche Telekom AG + * SPDX-FileContributor: Sartura Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #include "utils/ip_data.h" #include "utils/memory.h" #include @@ -235,4 +248,4 @@ void ip_neighbor_list_free(ip_neighbor_list_t *nbor_ls) FREE_SAFE(nbor_ls->nbor); } ip_neighbor_list_init(nbor_ls); -} \ No newline at end of file +} diff --git a/src/utils/ip_data.h b/src/utils/ip_data.h index a85b6938..4d61b21b 100644 --- a/src/utils/ip_data.h +++ b/src/utils/ip_data.h @@ -1,3 +1,16 @@ +/* + * telekom / sysrepo-plugin-interfaces + * + * This program is made available under the terms of the + * BSD 3-Clause license which is available at + * https://opensource.org/licenses/BSD-3-Clause + * + * SPDX-FileCopyrightText: 2021 Deutsche Telekom AG + * SPDX-FileContributor: Sartura Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #ifndef IP_DATA_H_ONCE #define IP_DATA_H_ONCE diff --git a/src/utils/ipv4_data.h b/src/utils/ipv4_data.h index f68fa8a2..64626fa0 100644 --- a/src/utils/ipv4_data.h +++ b/src/utils/ipv4_data.h @@ -1,3 +1,16 @@ +/* + * telekom / sysrepo-plugin-interfaces + * + * This program is made available under the terms of the + * BSD 3-Clause license which is available at + * https://opensource.org/licenses/BSD-3-Clause + * + * SPDX-FileCopyrightText: 2021 Deutsche Telekom AG + * SPDX-FileContributor: Sartura Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #ifndef IPv4_DATA_H_ONCE #define IPv4_DATA_H_ONCE diff --git a/src/utils/ipv6_data.c b/src/utils/ipv6_data.c index 437dd1f4..f6424d8c 100644 --- a/src/utils/ipv6_data.c +++ b/src/utils/ipv6_data.c @@ -1,3 +1,16 @@ +/* + * telekom / sysrepo-plugin-interfaces + * + * This program is made available under the terms of the + * BSD 3-Clause license which is available at + * https://opensource.org/licenses/BSD-3-Clause + * + * SPDX-FileCopyrightText: 2021 Deutsche Telekom AG + * SPDX-FileContributor: Sartura Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #include "utils/ipv6_data.h" #include #include @@ -40,4 +53,4 @@ void ipv6_autoconf_init(ipv6_autoconf_t *a) a->create_temp_addr = 0; a->temp_preffered_lifetime = 0; a->temp_valid_lifetime = 0; -} \ No newline at end of file +} diff --git a/src/utils/ipv6_data.h b/src/utils/ipv6_data.h index d39ef37a..820effa7 100644 --- a/src/utils/ipv6_data.h +++ b/src/utils/ipv6_data.h @@ -1,3 +1,16 @@ +/* + * telekom / sysrepo-plugin-interfaces + * + * This program is made available under the terms of the + * BSD 3-Clause license which is available at + * https://opensource.org/licenses/BSD-3-Clause + * + * SPDX-FileCopyrightText: 2021 Deutsche Telekom AG + * SPDX-FileContributor: Sartura Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #ifndef IPv6_DATA_H_ONCE #define IPv6_DATA_H_ONCE diff --git a/src/utils/link_data.c b/src/utils/link_data.c index 1e478cb0..6a7c80a5 100644 --- a/src/utils/link_data.c +++ b/src/utils/link_data.c @@ -1,3 +1,16 @@ +/* + * telekom / sysrepo-plugin-interfaces + * + * This program is made available under the terms of the + * BSD 3-Clause license which is available at + * https://opensource.org/licenses/BSD-3-Clause + * + * SPDX-FileCopyrightText: 2021 Deutsche Telekom AG + * SPDX-FileContributor: Sartura Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #include #include "utils/ip_data.h" #include "utils/ipv4_data.h" diff --git a/src/utils/link_data.h b/src/utils/link_data.h index d7791ca3..f7b16f1d 100644 --- a/src/utils/link_data.h +++ b/src/utils/link_data.h @@ -1,3 +1,16 @@ +/* + * telekom / sysrepo-plugin-interfaces + * + * This program is made available under the terms of the + * BSD 3-Clause license which is available at + * https://opensource.org/licenses/BSD-3-Clause + * + * SPDX-FileCopyrightText: 2021 Deutsche Telekom AG + * SPDX-FileContributor: Sartura Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + #ifndef LINK_DATA_H_ONCE #define LINK_DATA_H_ONCE