Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Build and Test DCE

on:
push:
branches: [ sikabo_master ]
pull_request:
branches: [ sikabo_master ]
workflow_dispatch:

env:
NS3_VER: "3.46"

jobs:
build:
name: Build on ${{ matrix.distro }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- distro: ubuntu-22.04
image: ubuntu:22.04
- distro: ubuntu-24.04
image: ubuntu:24.04
- distro: debian-trixie
image: debian:trixie
container:
image: ${{ matrix.image }}
steps:
- name: Install dependencies
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y \
git \
gcc \
g++ \
python3 \
python3-dev \
cmake \
ninja-build \
pkg-config \
libgsl-dev \
libsqlite3-dev \
libxml2-dev \
wget \
make

- name: Configure git safe directory
run: git config --global --add safe.directory "$GITHUB_WORKSPACE/ns-3-dce"

- name: Checkout DCE repository
uses: actions/checkout@v4
with:
path: ns-3-dce

- name: Cache NS-3 build
id: cache-ns3
uses: actions/cache@v4
with:
path: build/
key: ns3-${{ env.NS3_VER }}-${{ matrix.distro }}
restore-keys: |
ns3-${{ env.NS3_VER }}-${{ matrix.distro }}

- name: Clone NS-3
if: steps.cache-ns3.outputs.cache-hit != 'true'
run: |
git clone --branch "ns-${{ env.NS3_VER }}" --depth 1 \
https://gitlab.com/nsnam/ns-3-dev.git "ns-${{ env.NS3_VER }}"

- name: Configure NS-3
if: steps.cache-ns3.outputs.cache-hit != 'true'
working-directory: ns-${{ env.NS3_VER }}
run: |
./ns3 configure \
--disable-werror \
--prefix="$GITHUB_WORKSPACE/build" \
--build-profile=release

- name: Build NS-3
if: steps.cache-ns3.outputs.cache-hit != 'true'
working-directory: ns-${{ env.NS3_VER }}
run: ./ns3 build

- name: Install NS-3
if: steps.cache-ns3.outputs.cache-hit != 'true'
working-directory: ns-${{ env.NS3_VER }}
run: ./ns3 install

- name: Configure DCE
working-directory: ns-3-dce
run: |
./waf configure \
--with-ns3="$GITHUB_WORKSPACE/build" \
--prefix="$GITHUB_WORKSPACE/build" \
--enable-opt

- name: Build DCE
working-directory: ns-3-dce
run: ./waf build

- name: Build bash for DCE
working-directory: ns-3-dce
run: ./utils/build_bash.sh build/bin_dce

- name: Run DCE tests
working-directory: ns-3-dce
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/build/lib:${{ github.workspace }}/build/lib64
run: python3 test.py
2 changes: 1 addition & 1 deletion bindings/python/genbinds.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import sys
import os, errno
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ int main ()
return

gccxml_version_line = os.popen(gccxml[0] + " --version").readline().strip()
m = re.match( "^GCC-XML version (\d\.\d(\.\d)?)$", gccxml_version_line)
m = re.match(r'^GCC-XML version (\d\.\d(\.\d)?)$', gccxml_version_line)
gccxml_version = m.group(1)
gccxml_version_ok = ([int(s) for s in gccxml_version.split('.')] >= [0, 9])
conf.msg('Checking for gccxml version', gccxml_version)
Expand Down
2 changes: 1 addition & 1 deletion example/dce-tcp-simple.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main (int argc, char *argv[])
apps = dce.Install (nodes.Get (0));
apps.Start (Seconds (4.0));

Simulator::Stop (Seconds (1000100.0));
Simulator::Stop (Seconds (60.0));
Simulator::Run ();
Simulator::Destroy ();

Expand Down
10 changes: 5 additions & 5 deletions example/examples-to-run.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-

# A list of C++ examples to run in order to ensure that they remain
Expand All @@ -16,12 +16,12 @@
# ("dce-tap-udp-echo", "True", "True"),
# ("dce-tap-ccnd", "True", "True"),
# ("dce-tap-vlc", "True", "True"),
("dce-bash-simple", "True", "True"),
("dce-bash-simple", "BASH_DCE_FOUND == True", "BASH_DCE_FOUND == True"),
# ("dce-ccn-cache", "True", "True"),
("dce-linux-simple", "True", "True"),
("dce-linux", "True", "True"),
("dce-dccp", "True", "True"),
("dce-iperf", "True", "True"),
("dce-iperf", "IPERF_DCE_FOUND == True", "IPERF_DCE_FOUND == True"),
# ("dce-ccnd-udp-2-nodes", "True", "True"),
# ("dce-ccnd-linear-multiple", "True", "True"),
("dce-cradle-simple", "True", "True"),
Expand Down Expand Up @@ -57,8 +57,8 @@
("dce-xfrm", "False", "False"),
# ("dce-ltp", "True", "True"),
("dce-cradle-mptcp", "True", "True"),
("dce-iperf-mptcp", "True", "True"),
("dce-iperf-heterogeneous-multihop", "True", "True"),
("dce-iperf-mptcp", "IPERF_DCE_FOUND == True", "IPERF_DCE_FOUND == True"),
("dce-iperf-heterogeneous-multihop", "IPERF_DCE_FOUND == True", "IPERF_DCE_FOUND == True"),
("dce-mptcp-handoff-v6", "True", "True"),
("dce-mptcp-handoff-v6 --errRate=0.05", "True", "True"),
("dce-mptcp-handoff-v6 --errRate=0.1", "True", "True"),
Expand Down
1 change: 1 addition & 0 deletions example/tcp-loopback.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <sys/socket.h>
#include <netdb.h>
#include <string.h>
#include <pthread.h>
#include <iostream>

#define SERVER_PORT 2000
Expand Down
1 change: 1 addition & 0 deletions example/unix-client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <stdio.h>
#include <errno.h>
#include <sys/un.h>
#include <ctime>

#define SOCK_PATH "/tmp/socket"
#define BUF_LEN 128 * 1024 + 255
Expand Down
1 change: 1 addition & 0 deletions example/unix-server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <sys/un.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <ctime>

#define SOCK_PATH "/tmp/socket"
#define BUF_LEN 256
Expand Down
17 changes: 10 additions & 7 deletions helper/dce-manager-helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ TypeId
DceManagerHelper::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::DceManagerHelper")
.SetParent<ObjectBase> ()
.SetParent<Object> ()
.SetGroupName ("Dce")
.AddConstructor<DceManagerHelper> ()
.AddAttribute ("LoaderFactory",
"The kind of loader factory created when Install is called",
StringValue ("ns3::CoojaLoaderFactory[]"),
Expand All @@ -39,22 +41,23 @@ DceManagerHelper::GetTypeId (void)
;
return tid;
}
TypeId
DceManagerHelper::GetInstanceTypeId (void) const
{
return DceManagerHelper::GetTypeId ();
}

DceManagerHelper::DceManagerHelper ()
{
ConstructSelf (AttributeConstructionList ());
m_loaderFactory.SetTypeId ("ns3::CoojaLoaderFactory");
m_taskManagerFactory.SetTypeId ("ns3::TaskManager");
m_schedulerFactory.SetTypeId ("ns3::RrTaskScheduler");
m_managerFactory.SetTypeId ("ns3::DceManager");
m_networkStackFactory.SetTypeId ("ns3::Ns3SocketFdFactory");
m_delayFactory.SetTypeId ("ns3::RandomProcessDelayModel");
m_virtualPath = "";
}

void
DceManagerHelper::NotifyConstructionCompleted (void)
{
Object::NotifyConstructionCompleted ();
}
void
DceManagerHelper::SetScheduler (std::string type,
std::string n0, const AttributeValue &v0,
Expand Down
3 changes: 2 additions & 1 deletion helper/dce-manager-helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,14 @@ class DceManagerHelper : public Object
{
public:
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;

/**
* Construct a DceManagerHelper
*/
DceManagerHelper ();

void NotifyConstructionCompleted (void) override;

/**
* \param type the name of the TaskScheduler to set
* \param n0 the name of the attribute to set to the TaskScheduler
Expand Down
2 changes: 1 addition & 1 deletion model/dce-application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ DceApplication::StartApplication (void)

Ptr<Node> node = GetNode ();
Ptr<DceManager> manager = node->GetObject<DceManager> ();
if (manager == 0)
if (!manager)
{
NS_FATAL_ERROR ("You forgot to aggregate a DceManager to node=" << node->GetId ());
}
Expand Down
48 changes: 45 additions & 3 deletions model/dce-at.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ NS_LOG_COMPONENT_DEFINE ("DceAt");

using namespace ns3;

int dce___fxstatat (int ver, int fd, const char *pathname, struct stat *buf, int flag)
int dce_fstatat (int fd, const char *pathname, struct stat *buf, int flag)
{
Thread *current = Current ();
NS_LOG_FUNCTION (current << UtilsGetNodeId () << pathname << buf);
Expand All @@ -58,12 +58,12 @@ int dce___fxstatat (int ver, int fd, const char *pathname, struct stat *buf, int
current->err = EBADF;
return -1;
}
retval = ::__fxstatat (ver, realFd, pathname, buf, flag);
retval = ::fstatat (realFd, pathname, buf, flag);
}
else
{
std::string path = UtilsGetCurrentDirName () + "/" + UtilsGetRealFilePath (pathname);
retval = ::__fxstatat (ver, fd, path.c_str (), buf, flag);
retval = ::fstatat (fd, path.c_str (), buf, flag);
}
if (retval == -1)
{
Expand All @@ -72,6 +72,48 @@ int dce___fxstatat (int ver, int fd, const char *pathname, struct stat *buf, int
}
return retval;
}

int dce_fstatat64(int dirfd, const char * path, struct stat64 * stat_buf, int flags)
{
Thread *current = Current ();
NS_LOG_FUNCTION (current << UtilsGetNodeId () << path << stat_buf);
NS_ASSERT (current != 0);
int retval = -1;

if ((0 == path) || (0 == stat_buf))
{
current->err = EFAULT;
return -1;
}
if (std::string (path) == "")
{
current->err = ENOENT;
return -1;
}
if (dirfd != AT_FDCWD && path[0] != '/')
{
int realFd = getRealFd (dirfd, current);

if (realFd < 0)
{
current->err = EBADF;
return -1;
}
retval = ::fstatat64 (realFd, path, stat_buf, flags);
}
else
{
std::string path = UtilsGetCurrentDirName () + "/" + UtilsGetRealFilePath (path);
retval = ::fstatat64 (dirfd, path.c_str (), stat_buf, flags);
}
if (retval == -1)
{
current->err = errno;
return -1;
}
return retval;
}

void unlink_notify (std::string fullpath);
int dce_unlinkat (int fd, const char *pathname, int flags)
{
Expand Down
4 changes: 2 additions & 2 deletions model/dce-fd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,12 @@ void unlink_notify (std::string fullpath)

Ptr<SocketFdFactory> factory = Current ()->process->manager->GetObject<LocalSocketFdFactory> ();

if (0 != factory)
if (factory)
{
factory->UnlinkNotify (fullpath);
}
factory = Current ()->process->manager->GetObject<SocketFdFactory> ();
if (0 != factory)
if (factory)
{
factory->UnlinkNotify (fullpath);
}
Expand Down
2 changes: 1 addition & 1 deletion model/dce-misc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ NS_LOG_COMPONENT_DEFINE ("DceMisc");
int dce_uname (struct utsname *buf)
{
Ptr<DceNodeContext> nodeContext = DceNodeContext::GetNodeContext ();
NS_ASSERT (0 != nodeContext);
NS_ASSERT (nodeContext);

return nodeContext->UName (buf);
}
Expand Down
7 changes: 1 addition & 6 deletions model/dce-node-context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ DceNodeContext::GetTypeId (void)

return tid;
}
TypeId
DceNodeContext::GetInstanceTypeId (void) const
{
return DceNodeContext::GetTypeId ();
}
DceNodeContext::DceNodeContext ()
{
m_randomCtx = CreateObject<NormalRandomVariable> ();
Expand Down Expand Up @@ -79,7 +74,7 @@ DceNodeContext::UName (struct utsname *buf)
{
uint32_t nodeId = UtilsGetNodeId ();
Ptr<Node> node = NodeList::GetNode (nodeId);
NS_ASSERT (node != 0);
NS_ASSERT (node);
std::string nodeName = Names::FindName (node);
std::ostringstream oss;

Expand Down
1 change: 0 additions & 1 deletion model/dce-node-context.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class DceNodeContext : public Object
{
public:
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;

DceNodeContext ();
virtual ~DceNodeContext ();
Expand Down
Loading