Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
fbshipit-source-id: d0adf5cb39a450d61ace1cd7b63396a1b6372ce9
  • Loading branch information
facebook-github-bot committed May 11, 2023
0 parents commit 4faa3d4
Show file tree
Hide file tree
Showing 5,573 changed files with 1,314,907 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
47 changes: 47 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
AccessModifierOffset: -1
AlignAfterOpenBracket: AlwaysBreak
AlignEscapedNewlinesLeft: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: true
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: false
BreakBeforeBraces: Attach
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
ExperimentalAutoDetectBinPacking: true
IndentCaseLabels: true
IndentFunctionDeclarationAfterType: false
IndentWidth: 2
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 10
PenaltyBreakComment: 60
PenaltyBreakFirstLessLess: 20
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
...
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git
61 changes: 61 additions & 0 deletions .github/workflows/client_tester_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Docker Image CI for M-Plane Client

on:
push:
branches:
- 'main'
paths:
- 'mplane_client/CMakeLists.txt'
- 'mplane_client/src/**'
- 'mplane_client/test/**'
- 'mplane_client/utils/**'

env:
REGISTRY: ghcr.io
OWNER: ${{ github.repository_owner }}
TESTER_IMAGE_NAME: mplane/mplane-client-tester:latest
INT_TESTER_IMAGE_NAME: mplane/mplane-client-integrated-tester:latest
INT_TESTER_CONTAINER_NAME: tester
INT_TESTER_CONTAINER_PORT: 18300:830

jobs:
build-and-push-images:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Docker images
run: ./mplane_client/test/docker/build_docker.sh
shell: bash

- name: Show Docker images
run: docker images

- name: Run integrated Docker image
run: |
docker run --name ${{ env.INT_TESTER_CONTAINER_NAME }} --env-file ./mplane_client/test/docker/.env -p 18300:830 -d ${{ env.INT_TESTER_IMAGE_NAME }}
sleep 10
- name: Test integrated Docker image
run: |
docker exec ${{ env.INT_TESTER_CONTAINER_NAME }} sh -c "cat /home/netconf/.ssh/melacon.server.key.pub > /home/netconf/.ssh/authorized_keys"
docker exec ${{ env.INT_TESTER_CONTAINER_NAME }} sh -c "./wrapper.sh ./mpc_tester"
- name: Tag Docker images
run: |
docker tag ${{ env.TESTER_IMAGE_NAME }} ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.TESTER_IMAGE_NAME }}
docker tag ${{ env.INT_TESTER_IMAGE_NAME }} ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.INT_TESTER_IMAGE_NAME }}
- name: Push Docker images to GitHub Container Registry
run: |
docker push ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.TESTER_IMAGE_NAME }}
docker push ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.INT_TESTER_IMAGE_NAME }}
32 changes: 32 additions & 0 deletions .github/workflows/deploy-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deploy to GitHub Pages

on:
push:
branches:
- main

jobs:
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
defaults:
run:
working-directory: libhalmplane
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt -y install doxygen
- name: Build website
run: make docs
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./libhalmplane/html
# The following lines assign commit authorship to the official
# GH-Actions bot for deploys to `gh-pages` branch:
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
# The GH actions bot is used by default if you didn't specify the two fields.
# You can swap them out with your own user credentials.
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.DS_Store

# Build ephemera
**/build
**/.settings
fb-oru/buildTools/cmake/.build.mk
*.tar.gz
*.tgz
*.tar.xz
*.tar.bz2
fb-oru/buildTools/sysroot

# M-Plane Client ephemera
mplane_client/deps
mplane_client/build
mplane_client/test/docker/sim-o1-interface

# Symlinks and fbpkg
fbpkg
fb-oru/halmplane
fb-oru/fpga
fb-oru/ros/packages
fb-oru/buildTools/local-tools
fb-oru/ros/configs/petalinux2020.1/ATLAS/ORAN/Atlas_ORAN_RFFEM.bit
fb-oru/ros/configs/petalinux2020.1/ATLAS/ORAN/Atlas_ORAN_RFFEM.bsp
fb-oru/ros/configs/petalinux2020.1/FBZCU27/ORAN/FBZCU27_ORAN_RFFEM.bit
fb-oru/ros/configs/petalinux2020.1/FBZCU27/ORAN/FBZCU27_ORAN_RFFEM.bsp
fb-oru/ros/configs/petalinux2020.1/ZCU111/ORAN/zcu111_RFSoC_ORAN.bit
fb-oru/ros/configs/petalinux2020.1/ZCU111/ORAN/zcu111_RFSoC_ORAN.bsp

# Yocto
meta-mplane/yocto
meta-mplane/build-*
meta-mplane/utils/app.tgz

# Petalinux
meta-mplane/petalinux/zcu111
80 changes: 80 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, 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.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers 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, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.

This Code of Conduct also applies outside the project spaces when there is a
reasonable belief that an individual's behavior may have a negative impact on
the project or its community.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at <[email protected]>. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
31 changes: 31 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Contributing to Open M-Plane
We want to make contributing to this project as easy and transparent as
possible.

## Pull Requests
We actively welcome your pull requests.

1. Fork the repo and create your branch from `main`.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes.
5. Make sure your code lints.
6. If you haven't already, complete the Contributor License Agreement ("CLA").

## Contributor License Agreement ("CLA")
In order to accept your pull request, we need you to submit a CLA. You only need
to do this once to work on any of Meta's open source projects.

Complete your CLA here: <https://code.facebook.com/cla>

## Issues
We use GitHub issues to track public bugs. Please ensure your description is
clear and has sufficient instructions to be able to reproduce the issue.

Meta has a [bounty program](https://www.facebook.com/whitehat/) for the safe
disclosure of security bugs. In those cases, please go through the process
outlined on that page and do not file a public issue.

## License
By contributing to Open M-Plane, you agree that your contributions will be licensed
under the LICENSE file in the root directory of this source tree.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Meta Platforms, Inc. and affiliates.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Open M-Plane
This repository contains software implementing portions of the Management Plane
(M-Plane) according to O-RAN Alliance specifications. The M-Plane is part of the
Open Fronthaul Interface specified by O-RAN Workgroup 4.

## Repository Contents
* **meta-mplane** - Yocto meta layer for building the M-Plane software along
with its dependencies.
* **libhalmplane** - Hardware abstraction layer to integrate
hardware-dependent configurations with the M-Plane server.
* **mplane_server** - Standalone M-Plane server application, largely based on
the implementation in `fb-oru`.
* **mplane_client** - M-Plane client implementation.
* **climp** - A command-line interface utility for M-Plane operations.
* **fb-oru** - Code for the operating system and applications of an O-RU. This
includes the legacy implementation of the M-Plane server, which has most of
its code contained in `fb-oru/yang-manager-server`.

## License
Open M-Plane is MIT licensed, as found in the LICENSE file.
53 changes: 53 additions & 0 deletions climp/IMPLEMENTATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# CLIMP Implementation

## LuaJIT FFI
CLIMP uses LuaJIT's FFI (Foreign Function Interface) library to load the shared
library containing HAL functions and make the subsequent function calls. The FFI
library allows the Lua program to directly call external C functions and access
C data structures.

The code block below demonstrates the basic steps:
```lua
-- 1. Load the FFI library
local ffi = require "ffi"

-- 2. Load the shared library containing the HAL functions
ffi.load("libhalmplane.so")

-- 3. Add C function declarations for the HAL functions
ffi.cdef(halmplane_error_t halmplane_get_io_value(external_io_t *io))

-- 4. Call the HAL functions
ffi.halFunc.halmplane_get_io_value(external_io)
```

## Error Codes
Each HAL function returns an enum `halmplane_error_t` representing the error
code. A full list with descriptions can be found in the CLIMP function
`logErrorWithContext()`.

To add a new error code:
1. Create a new `halmplane_error_t` enum value in `MplaneEnums.h`
2. Update the `halmplane_error_t` definition in `mplane/hal.lua`
3. Add a new error message in `logErrorWithContext()` in `climp.lua`

## Adding New Commands
To add a new CLI command, follow the steps below:

### 1. Include the New HAL Functions in `libhalmplane.so`
1. Create a header file containing HAL functions, typedefs, and any other
definitions for the YANG model
2. Implement the HAL functions in the source file
3. Add the new header file to the list of files to install in
`libhalmplane/CMakeLists.txt`
4. Add the source file to the `SRC` variable in
`libhalmplane/<board>/CMakeLists.txt`

### 2. Make New HAL Functions Available in CLIMP
1. Add a new `ffi.cdef()` call in `mplane/hal.lua`
2. Add all the function definitions and typedefs in the `ffi.cdef()` block

### 3. Add New CLIMP Commands
1. Create a new function to add the desired command and subcommands to the CLI
parser in `createParser()`
2. Implement a callback function (specified by `action`) for each command
Loading

0 comments on commit 4faa3d4

Please sign in to comment.