fix: cleanup for onboarding
This commit is contained in:
41
.devcontainer/devcontainer.json
Normal file
41
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,41 @@
|
||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
|
||||
{
|
||||
"name": "Existing Docker Compose (Extend)",
|
||||
|
||||
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
|
||||
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
|
||||
"dockerComposeFile": [
|
||||
"../compose.dev.yml",
|
||||
"docker-compose.yml"
|
||||
],
|
||||
|
||||
// The 'service' property is the name of the service for the container that VS Code should
|
||||
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
|
||||
"service": "sim",
|
||||
|
||||
// The optional 'workspaceFolder' property is the path VS Code should open by default when
|
||||
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
|
||||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}"
|
||||
|
||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||
// "features": {},
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [],
|
||||
|
||||
// Uncomment the next line if you want start specific services in your Docker Compose config.
|
||||
// "runServices": [],
|
||||
|
||||
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
|
||||
// "shutdownAction": "none",
|
||||
|
||||
// Uncomment the next line to run commands after the container is created.
|
||||
// "postCreateCommand": "cat /etc/os-release",
|
||||
|
||||
// Configure tool-specific properties.
|
||||
// "customizations": {},
|
||||
|
||||
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
|
||||
// "remoteUser": "devcontainer"
|
||||
}
|
||||
26
.devcontainer/docker-compose.yml
Normal file
26
.devcontainer/docker-compose.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
version: '3.8'
|
||||
services:
|
||||
# Update this to the name of the service you want to work with in your docker-compose.yml file
|
||||
sim:
|
||||
# Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
|
||||
# folder. Note that the path of the Dockerfile and context is relative to the *primary*
|
||||
# docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
|
||||
# array). The sample below assumes your primary file is in the root of your project.
|
||||
#
|
||||
# build:
|
||||
# context: .
|
||||
# dockerfile: .devcontainer/Dockerfile
|
||||
|
||||
volumes:
|
||||
# Update this to wherever you want VS Code to mount the folder of your project
|
||||
- ..:/workspaces:cached
|
||||
|
||||
# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
|
||||
# cap_add:
|
||||
# - SYS_PTRACE
|
||||
# security_opt:
|
||||
# - seccomp:unconfined
|
||||
|
||||
# Overrides default command so things don't shut down after the process ends.
|
||||
command: /bin/sh -c "while sleep 1000; do :; done"
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
FROM ns3-base AS sim
|
||||
COPY ./scratch /ns3/latest/scratch
|
||||
COPY ./contrib /ns3/latest/contrib
|
||||
ENV PATH="/ns3/latest:$PATH"
|
||||
ENV PATH="/ns3/latest:$PATH"
|
||||
WORKDIR /ns3/latest
|
||||
RUN ./ns3 configure
|
||||
RUN ./ns3 build
|
||||
|
||||
@@ -60,13 +60,13 @@ RUN mv ./ns-allinone-$VERSION/ns-$VERSION /ns3/$VERSION && ln -s /ns3/$VERSION /
|
||||
WORKDIR /ns3/latest
|
||||
|
||||
# Configure
|
||||
RUN ./ns3 configure
|
||||
#--enable-examples --enable-tests
|
||||
RUN ./ns3 configure \
|
||||
--enable-examples --enable-tests
|
||||
|
||||
# Build
|
||||
RUN ./ns3 build
|
||||
|
||||
ENV PATH="/ns3/latest :${PATH}"
|
||||
ENV PATH="/ns3/latest:${PATH}"
|
||||
|
||||
# Test
|
||||
#RUN ./test.py
|
||||
|
||||
@@ -15,6 +15,8 @@ services:
|
||||
- ./contrib:/ns3/latest/contrib
|
||||
depends_on:
|
||||
- base
|
||||
environment:
|
||||
- NS_LOG=ModulatedCCA=all
|
||||
image: ns3-sim
|
||||
|
||||
|
||||
|
||||
1
contrib/modulatedCCA
Submodule
1
contrib/modulatedCCA
Submodule
Submodule contrib/modulatedCCA added at 0b955062cd
69
scratch/modulated-cca.cc
Normal file
69
scratch/modulated-cca.cc
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "ns3/modulatedCCA-helper.h"
|
||||
#include "ns3/applications-module.h"
|
||||
#include "ns3/core-module.h"
|
||||
#include "ns3/internet-module.h"
|
||||
#include "ns3/network-module.h"
|
||||
#include "ns3/point-to-point-module.h"
|
||||
#include "ns3/log.h"
|
||||
|
||||
/**
|
||||
* \file
|
||||
*
|
||||
* Explain here what the example does.
|
||||
*/
|
||||
|
||||
using namespace ns3;
|
||||
NS_LOG_COMPONENT_DEFINE("ModulatedCCAExample");
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
bool verbose = true;
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("verbose", "Tell application to log if true", verbose);
|
||||
|
||||
cmd.Parse(argc, argv);
|
||||
|
||||
// Setup two nodes
|
||||
NodeContainer nodes;
|
||||
nodes.Create(2);
|
||||
|
||||
PointToPointHelper pointToPoint;
|
||||
pointToPoint.SetDeviceAttribute("DataRate", StringValue("5Mbps"));
|
||||
pointToPoint.SetChannelAttribute("Delay", StringValue("2ms"));
|
||||
|
||||
NetDeviceContainer devices;
|
||||
devices = pointToPoint.Install(nodes);
|
||||
|
||||
InternetStackHelper stack;
|
||||
stack.Install(nodes);
|
||||
|
||||
Ipv4AddressHelper address;
|
||||
address.SetBase("10.1.1.0", "255.255.255.0");
|
||||
|
||||
Ipv4InterfaceContainer interfaces = address.Assign(devices);
|
||||
|
||||
Ipv4Address serverAddress = interfaces.GetAddress(1);
|
||||
|
||||
// Create ModulatedCCA
|
||||
ModulatedCCAHelper modulatedCCA(serverAddress);
|
||||
|
||||
ApplicationContainer app = modulatedCCA.Install(nodes.Get(0));
|
||||
ModulatedCCA::ModulationConfig config = {ModulatedCCA::ModulationType::SIN, 1.0, 1.0, DataRate("1kbps")};
|
||||
|
||||
app.Get(0) -> SetAttribute("Name", StringValue("CCA_1"));
|
||||
Ptr<ModulatedCCA> app1 = DynamicCast<ModulatedCCA>(app.Get(0));
|
||||
app1 -> SetConfig(config);
|
||||
DataRate rateA = DataRate("100Mbps");
|
||||
DataRate rateB = DataRate("1000Mbps");
|
||||
DataRate rateC = rateA - rateB;
|
||||
app.Start(Seconds(1.0));
|
||||
app.Stop(Seconds(10.0));
|
||||
|
||||
NS_LOG_INFO("Run Simulation.");
|
||||
Simulator::Run();
|
||||
NS_LOG_UNCOND("Done.");
|
||||
NS_LOG_UNCOND("Total Tx: " << DynamicCast<ModulatedCCA>(app.Get(0))->GetTotalTx() << " bytes.");
|
||||
Simulator::Destroy();
|
||||
return 0;
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// This file contains the implementation of the functions declared in the
|
||||
// corresponding header file.
|
||||
|
||||
#include "scratch-subdir-additional-header.h"
|
||||
|
||||
namespace ns3
|
||||
{
|
||||
|
||||
std::string
|
||||
ScratchSubdirGetMessage()
|
||||
{
|
||||
return "Scratch Subdir";
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// This header does not provide much functionality but is meant to demonstrate how,
|
||||
// in a scratch subdirectory, one can create new programs that are implemented
|
||||
// in multiple files and headers.
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace ns3
|
||||
{
|
||||
|
||||
/**
|
||||
* Get a message from the subdir.
|
||||
*
|
||||
* \return The message from the subdir
|
||||
*/
|
||||
std::string ScratchSubdirGetMessage();
|
||||
|
||||
} // namespace ns3
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// This example shows how to create new simulations that are implemented in
|
||||
// multiple files and headers. The structure of this simulation project
|
||||
// is as follows:
|
||||
//
|
||||
// scratch/
|
||||
// | subdir/
|
||||
// | | - scratch-subdir.cc // Main simulation file
|
||||
// | | - scratch-subdir-additional-header.h // Additional header
|
||||
// | | - scratch-subdir-additional-header.cc // Additional header implementation
|
||||
//
|
||||
// This file contains the main() function, which calls an external function
|
||||
// defined in the "scratch-subdir-additional-header.h" header file and
|
||||
// implemented in "scratch-subdir-additional-header.cc".
|
||||
|
||||
#include "scratch-subdir-additional-header.h"
|
||||
|
||||
#include "ns3/core-module.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE("ScratchSubdir");
|
||||
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
std::string message = ScratchSubdirGetMessage();
|
||||
NS_LOG_UNCOND(message);
|
||||
|
||||
Simulator::Run();
|
||||
Simulator::Destroy();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user