Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Communications Backbone System
communications-backbone
Commits
e4b42db1
Unverified
Commit
e4b42db1
authored
2 years ago
by
Dan Jones
Browse files
Options
Download
Email Patches
Plain Diff
docs: update changelog and version
+ remove obsolete code
parent
f987d4dc
Pipeline
#114751
passed with stages
in 1 minute and 17 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
137 deletions
+37
-137
CHANGELOG.md
CHANGELOG.md
+36
-0
old_mq_wrapper/soar_broadcast.py
old_mq_wrapper/soar_broadcast.py
+0
-35
old_mq_wrapper/soar_forward.py
old_mq_wrapper/soar_forward.py
+0
-33
old_mq_wrapper/soar_publish.py
old_mq_wrapper/soar_publish.py
+0
-42
old_mq_wrapper/soar_push.py
old_mq_wrapper/soar_push.py
+0
-0
old_mq_wrapper/soar_subscribe.py
old_mq_wrapper/soar_subscribe.py
+0
-26
setup.py
setup.py
+1
-1
No files found.
CHANGELOG.md
0 → 100644
View file @
e4b42db1
# Changelog
All notable changes to this project will be documented in this file.
The format is based on
[
Keep a Changelog
](
http://keepachangelog.com/en/1.0.0/
)
and this project adheres to
[
Semantic Versioning
](
http://semver.org/spec/v2.0.0.html
)
.
## [Unreleased]
## [v0.1.0] - 2023-03-24
### Added
Create a mechanism to exchange messages between multiple clients
Bus
-
Implements persistent queues per client
-
Implements publish/subscribe message flow between clients
-
Implements broadcast message flow between clients
-
Listens for and responds to add/remove clients
API
-
Implements clients endpoint to manage clients and subscriptions
-
Implements token endpoint to manage authentication client credentials grants
-
Implements send endpoint for publishing
-
Implements notify endpoint for broadcasts
-
Implements receive endpoint to get messages
Docker
-
Run local dev environment in docker-compose
[
v0.1.0
]:
https://git.noc.ac.uk/communications-backbone-system/communications-backbone/compare/611d9cab...v0.1.0
[
unreleased
]:
https://git.noc.ac.uk/communications-backbone-system/communications-backbone/compare/v0.1.0...dev
This diff is collapsed.
Click to expand it.
old_mq_wrapper/soar_broadcast.py
deleted
100644 → 0
View file @
f987d4dc
#!/usr/bin/env python
import
pika
def
get_connection
():
return
pika
.
BlockingConnection
(
pika
.
ConnectionParameters
(
host
=
"localhost"
))
def
deliver
(
body
,
broadcast_exchange
):
print
(
"broadcast"
)
deliver_connection
=
get_connection
()
deliver_channel
=
deliver_connection
.
channel
()
deliver_channel
.
exchange_declare
(
exchange
=
broadcast_exchange
,
exchange_type
=
"fanout"
)
deliver_channel
.
basic_publish
(
exchange
=
broadcast_exchange
,
routing_key
=
""
,
body
=
body
)
deliver_connection
.
close
()
def
listen
(
queue_name
,
broadcast_exchange
):
def
bcast_callback
(
ch
,
method
,
properties
,
body
):
delivered
=
deliver
(
body
,
broadcast_exchange
)
ch
.
basic_ack
(
delivery_tag
=
method
.
delivery_tag
)
listen_connection
=
get_connection
()
listen_channel
=
listen_connection
.
channel
()
listen_channel
.
queue_declare
(
queue
=
queue_name
,
durable
=
True
)
listen_channel
.
basic_consume
(
queue
=
queue_name
,
on_message_callback
=
bcast_callback
)
listen_channel
.
start_consuming
()
def
broadcast
(
queue_name
,
broadcast_exchange
=
"soar_broadcast"
):
listen
(
queue_name
,
broadcast_exchange
)
This diff is collapsed.
Click to expand it.
old_mq_wrapper/soar_forward.py
deleted
100644 → 0
View file @
f987d4dc
#!/usr/bin/env python
import
pika
def
get_connection
():
return
pika
.
BlockingConnection
(
pika
.
ConnectionParameters
(
host
=
"localhost"
))
def
deliver
(
body
,
queue_name
):
print
(
"forward to: %s"
%
queue_name
)
deliver_connection
=
get_connection
()
deliver_channel
=
deliver_connection
.
channel
()
deliver_channel
.
queue_declare
(
queue
=
queue_name
,
durable
=
True
)
deliver_channel
.
basic_publish
(
exchange
=
""
,
routing_key
=
queue_name
,
body
=
body
)
deliver_connection
.
close
()
def
listen
(
from_queue_name
,
to_queue_name
):
def
fwd_callback
(
ch
,
method
,
properties
,
body
):
delivered
=
deliver
(
body
,
to_queue_name
)
ch
.
basic_ack
(
delivery_tag
=
method
.
delivery_tag
)
listen_connection
=
get_connection
()
listen_channel
=
listen_connection
.
channel
()
listen_channel
.
queue_declare
(
queue
=
from_queue_name
,
durable
=
True
)
listen_channel
.
basic_consume
(
queue
=
from_queue_name
,
on_message_callback
=
fwd_callback
)
listen_channel
.
start_consuming
()
def
forward
(
from_queue_name
,
to_queue_name
):
listen
(
from_queue_name
,
to_queue_name
)
This diff is collapsed.
Click to expand it.
old_mq_wrapper/soar_publish.py
deleted
100644 → 0
View file @
f987d4dc
#!/usr/bin/env python
import
pika
import
json
import
sys
def
get_connection
():
return
pika
.
BlockingConnection
(
pika
.
ConnectionParameters
(
host
=
"localhost"
))
def
deliver
(
body
,
topic
,
publish_exchange
):
print
(
"publish on topic: %s"
%
topic
)
deliver_connection
=
get_connection
()
deliver_channel
=
deliver_connection
.
channel
()
deliver_channel
.
exchange_declare
(
exchange
=
publish_exchange
,
exchange_type
=
"topic"
)
deliver_channel
.
basic_publish
(
exchange
=
publish_exchange
,
routing_key
=
topic
,
body
=
body
)
deliver_connection
.
close
()
def
listen
(
queue_name
,
publish_exchange
):
def
pub_callback
(
ch
,
method
,
properties
,
body
):
message
=
json
.
loads
(
body
.
decode
())
topic
=
message
[
"topic"
]
deliver
(
body
,
topic
,
publish_exchange
)
ch
.
basic_ack
(
delivery_tag
=
method
.
delivery_tag
)
listen_connection
=
get_connection
()
listen_channel
=
listen_connection
.
channel
()
listen_channel
.
queue_declare
(
queue
=
queue_name
,
durable
=
True
)
listen_channel
.
basic_consume
(
queue
=
queue_name
,
on_message_callback
=
pub_callback
)
listen_channel
.
start_consuming
()
def
publish
(
queue_name
,
publish_exchange
=
"soar_publish"
):
listen
(
queue_name
,
publish_exchange
)
if
__name__
==
"__main__"
:
queue_name
=
sys
.
argv
[
1
]
publish
(
queue_name
)
This diff is collapsed.
Click to expand it.
old_mq_wrapper/soar_push.py
deleted
100644 → 0
View file @
f987d4dc
This diff is collapsed.
Click to expand it.
old_mq_wrapper/soar_subscribe.py
deleted
100644 → 0
View file @
f987d4dc
#!/usr/bin/env python
import
pika
def
get_connection
():
return
pika
.
BlockingConnection
(
pika
.
ConnectionParameters
(
host
=
"localhost"
))
def
subscribe
(
queue_name
,
topic
,
publish_exchange
=
"soar_publish"
,
broadcast_exchange
=
"soar_broadcast"
,
):
adm_connection
=
get_connection
()
admin_channel
=
adm_connection
.
channel
()
admin_channel
.
exchange_declare
(
exchange
=
broadcast_exchange
,
exchange_type
=
"fanout"
)
admin_channel
.
queue_bind
(
exchange
=
broadcast_exchange
,
queue
=
queue_name
)
sub_connection
=
get_connection
()
subscriber_channel
=
sub_connection
.
channel
()
subscriber_channel
.
exchange_declare
(
exchange
=
publish_exchange
,
exchange_type
=
"topic"
)
subscriber_channel
.
queue_bind
(
exchange
=
publish_exchange
,
queue
=
queue_name
,
routing_key
=
topic
)
This diff is collapsed.
Click to expand it.
setup.py
View file @
e4b42db1
...
...
@@ -5,7 +5,7 @@ requirements = [x.strip() for x in open("requirements.txt", "r") if x.strip() !=
setup
(
name
=
"communications-backbone"
,
version
=
"0.
0.1
"
,
version
=
"0.
1.0
"
,
description
=
"Communications backbone "
,
author
=
"NOC C2 Team"
,
author_email
=
"c2@noc.ac.uk"
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment