-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from ayushishu/main
Implement Composable Workflow Functionality in csit-1-node test and add README.md for OpenDaylight dockerfile
- Loading branch information
Showing
4 changed files
with
86 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: "ssh-setup" | ||
inputs: | ||
docker_repository: | ||
description: "Docker repository name" | ||
required: true | ||
robot_image: | ||
description: "Robot image name" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup SSH | ||
run: | | ||
# Set up SSH in the container | ||
docker exec odl-container bash -c "mkdir -p /home/user/.ssh && touch /home/user/.ssh/authorized_keys" | ||
shell: bash | ||
|
||
- name: Start robot container | ||
run: | | ||
# Start the robot container | ||
docker run -d --network container:odl-container --name robot ${{ inputs.docker_repository }}/${{ inputs.robot_image }} tail -f /dev/null | ||
shell: bash | ||
|
||
- name: Extract id_rsa.pub from the robot container | ||
id: extract_pubkey | ||
run: | | ||
# Extract the id_rsa.pub from the robot container | ||
docker exec robot cat /root/.ssh/id_rsa.pub > id_rsa.pub | ||
continue-on-error: true | ||
shell: bash | ||
|
||
- name: Add public key to opendaylight container | ||
run: | | ||
# Add the public key to the OpenDaylight container | ||
PUB_KEY=$(cat id_rsa.pub) | ||
docker exec odl-container bash -c "mkdir -p /home/user/.ssh && echo \"$PUB_KEY\" >> /home/user/.ssh/authorized_keys" | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Opendaylight Docker Image | ||
|
||
This Dockerfile creates an image that contains the Opendaylight Karaf distribution and an SSH server. The image can be used to run Opendaylight as a container and access it via SSH. | ||
|
||
## Prerequisites | ||
|
||
- Docker installed on your machine | ||
- A base image of either Ubuntu or CentOS | ||
|
||
## Build the Image | ||
|
||
By default, the Dockerfile uses Ubuntu as the base image. To build the image with CentOS as the base OS and specify the Karaf version as build arguments, run the following command: | ||
|
||
```bash | ||
docker build --build-arg BASE_IMAGE=centos --build-arg KARAF_VERSION=0.18.1 -t opendaylight:0.18.1 . | ||
``` | ||
|
||
This will create an image named opendaylight:0.18.1 with Centos as the base OS and Karaf 0.18.1 as the Opendaylight distribution. | ||
|
||
## Run the container | ||
To run the container, run the following command: | ||
```bash | ||
docker run -p 8181:8181 -p 8101:8101 -p 2222:22 opendaylight:0.18.1 | ||
``` | ||
### Environment Variables | ||
You can customize the behavior of the OpenDaylight container using environment variables: | ||
|
||
`FEATURES`: Specifies the Karaf features to be installed. For example, if you want to install additional features, set the FEATURES environment variable when running the container. For example: | ||
|
||
```bash | ||
docker run -d -p 8181:8181 -p 8101:8101 -p 2222:22 --name opendaylight --env FEATURES=odl-restconf,odl-netconf-topology opendaylight:0.18.1 | ||
``` | ||
### Access the container | ||
To access the container , | ||
```bash | ||
docker exec opendaylight -it bash | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters