From 3cda1acc924b18823050adf97eee9305a40acec5 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 10 Aug 2012 14:16:56 +0200 Subject: [PATCH] oml: Continue with the init sequence of the BTS init, create acks --- fakebts/OML.st | 22 +++++++++++++++ fakebts/OMLInit.st | 24 ++++++++++++++-- fakebts/OMLMsg.st | 68 ++++++++++++++++++++++++++++++++++++++++++++++ fakebts/Test.st | 11 ++++++++ 4 files changed, 122 insertions(+), 3 deletions(-) diff --git a/fakebts/OML.st b/fakebts/OML.st index 16e04b4..9523258 100644 --- a/fakebts/OML.st +++ b/fakebts/OML.st @@ -232,6 +232,28 @@ OMLManagerBase subclass: SiteManagerOML [ swLoaded := true. ] + softwareActivated [ + | op_state av_state | + + (swActivated or: [swLoaded]) + ifFalse: [^self error: 'SW not ready']. + + "Report the software being activated" + self forwardData: self createSwActivatedReport toMessage. + + "Update the state" + op_state := self operationalState. + op_state state: OMLOperationalState disabled. + av_state := self availabilityStatus. + av_state state: OMLAvailabilityStatus offline. + self sendStateChanged. + ] + + activateSoftware: aSWDescription [ + + swActivated := true. + ] + siteManager [ ^ self diff --git a/fakebts/OMLInit.st b/fakebts/OMLInit.st index 0002954..7856b7d 100644 --- a/fakebts/OMLInit.st +++ b/fakebts/OMLInit.st @@ -46,18 +46,36 @@ Object subclass: OMLBTSInit [ ] run [ - | msg | + | msg ack | "1. Initialize the SM" sm start. - "2. Activate the software" + "2. Load the software" msg := bts waitForOMLMsg. msg class = FOMMessage ifFalse: [self error: 'Failed to get a Formatted O&M message']. msg omDataField class = OMLSWActivateRequestAck ifFalse: [self error: 'Failed to get the SW Activate Request ACK']. Transcript nextPutAll: 'We were asked to activate something'; nl. - (Delay forSeconds: 1) wait. sm loadSoftware: msg omDataField swConfiguration. + + "3. Activate the software. The stateChanged triggered and activated + report are not the same as with the nanoBTS." + msg := bts waitForOMLMsg. + msg class = FOMMessage + ifFalse: [self error: 'Failed to get a Formatted O&M message']. + msg omDataField class = OMLActivateSoftware + ifFalse: [self error: 'Failed to get the SW Activate Request ACK']. + sm activateSoftware: msg omDataField swDescription. + ack := msg createAck. + self forwardOML: ack toMessage. + + "4. The SM has booted up, ask to activate the software" + sm softwareActivated. + self forwardOML: sm bts createSwActivateRequest toMessage. + + "5. OpStart or activate requests.." + msg := bts waitForOMLMsg. + msg inspect. ] ] diff --git a/fakebts/OMLMsg.st b/fakebts/OMLMsg.st index 39b9267..63d6216 100644 --- a/fakebts/OMLMsg.st +++ b/fakebts/OMLMsg.st @@ -557,6 +557,11 @@ Object subclass: OMLMessageBase [ ^ 16r0B ] + msgSWActivatedReport [ + + ^ 16r10 + ] + msgActivateSoftware [ ^ 16r0D @@ -645,6 +650,14 @@ OMLMessageBase subclass: FOMMessage [ putByte: msg size; putByteArray: msg. ] + + createAck [ + + "Try to create an ACK" + ^ self class new + omDataField: om_field createAck; + yourself + ] ] Object subclass: OMLDataField [ @@ -714,6 +727,16 @@ Object subclass: OMLDataField [ object_instance := anInstance ] + objectClass [ + + ^ object_class + ] + + objectInstance [ + + ^ object_instance + ] + writeOn: aMsg [ @@ -848,7 +871,52 @@ OMLDataField subclass: OMLActivateSoftware [ ^ OrderedCollection new add: (OMLSWDescription asTLVDescription + beOptional; instVarName: #sw_desc; yourself); yourself ] + + createAck [ + + ^ OMLActivateSoftwareAck new + objectClass: self objectClass; + objectInstance: self objectInstance; + swDescription: self swDescription; + yourself + ] + + swDescription [ + + ^ sw_desc + ] + + swDescription: aDesc [ + + sw_desc := aDesc + ] +] + +OMLActivateSoftware subclass: OMLActivateSoftwareAck [ + + + + OMLActivateSoftwareAck class >> attributeType [ + + ^ FOMMessage msgActivateSoftwareAck + ] +] + +OMLDataField subclass: OMLSWActivatedReport [ + + + + OMLSWActivatedReport class >> attributeType [ + + ^ FOMMessage msgSWActivatedReport + ] + + OMLSWActivatedReport class >> tlvDescription [ + + ^ #() + ] ] diff --git a/fakebts/Test.st b/fakebts/Test.st index 8fdd02b..d86d5e5 100644 --- a/fakebts/Test.st +++ b/fakebts/Test.st @@ -140,6 +140,10 @@ TestCase subclass: OMLMsgTest [ ^ #(128 128 0 18 13 0 255 255 255 66 18 0 3 1 2 3 19 0 3 3 4 5) ] + activationRequestDataAck [ + ^ #(128 128 0 18 14 0 255 255 255 66 18 0 3 1 2 3 19 0 3 3 4 5) + ] + testFomMessage [ | oml | @@ -192,6 +196,13 @@ TestCase subclass: OMLMsgTest [ data := oml toMessage asByteArray. self assert: self activationRequestData asByteArray = data ] + + testActivationRequest [ + | oml nack | + oml := OMLMessageBase parse: self activationRequestData readStream. + nack := oml createAck. + self assert: nack toMessage asByteArray = self activationRequestDataAck asByteArray. + ] ] TestCase subclass: TLVDescriptionTest [